0.0.1 • Published 9 years ago

nice-place-for-coding-parser v0.0.1

Weekly downloads
2
License
BSD-2-Clause
Repository
github
Last release
9 years ago

nice-place-for-coding-parser

Parse .md files into structured data for nice-place-for-coding

Why bother?

Although .json or .yaml format can be used directly without creating a parser, Markdown has its advantages:

  • It's human-readable
  • It's also structurally defined (like other dedicated format)
  • It's fun
  • It's not that much of a trouble

Format Spec

A valid file should contain at least one place entry. Each place entry should be in this format:

* Place name : place address

`

Notes on place

from @name_of_recommender

`

Note:

  • Nothing else can exist in between the list item and the code block
  • English colon must be used to separate place name and address. Spaces are allowed before and after the colon
  • Any contents (expect lists, both ordered an un-ordered ones) can be added between 2 place entries (see ./test/data/more-than-one.md)

Usage

Install:

npm install nice-place-for-coding-parser

Use:

Parser = require 'nice-place-for-coding-parser'

parser = new Parser()

places = parser.parse 'Markdown source'

Parser output:

[
  {
    name: 'name of place',
    address: 'address of place',
    note: 'note',
    recommendedBy: 'who'
  },
  // Other places
]