json-meta-marked
Convert markdown with json front matter to json object with metadata & html.
Works in both directions.
Works as cli
and required module
special feature
If you include a custom field
in the json
front matter, you can include {{field}}
or []({{field}})
in the markdown part and in the transformation process, those placeholders in the markdown will be replaced with the value of the custom field
of the json front matter
example
---{ "foo": "bar", "custom": { "something": "world", "beep": "boop" }}--- # Hello {{something}} This is an example, [{{beep}}]({{beep}}) [//]: # (@TODO: this is a comment) * one* two* three yay, foobar :-)
will be transformed to:
required module
-- markdown2json
USAGE - When [jsonfront.md]
---{ "name": "Metadata", "CONTENT": [ "pitch", "news", "requirements", "program", "schedule", "support", "contribute", "about" ]}--- # Metadata of content
[markdown2json.js]
var jmm = ;var fs = ;var obj = jmm;console;
$> node markdown2json.js
required module
-- json2markdown
USAGE - When [htmlified.json]
[json2markdown.js]
var jmm = ;var fs = ;var obj = JSON;console;
$> node json2markdown.js
---{ "name": "Metadata", "CONTENT": [ "pitch", "news", "requirements", "program", "schedule", "support", "contribute", "about" ]}--- # Metadata of content
cli
- markdown2json
USAGE - From [jsonfront.md]
---{ "name": "Metadata", "CONTENT": [ "pitch", "news", "requirements", "program", "schedule", "support", "contribute", "about" ]}--- # Metadata of content
cli:
$> node install -g json-meta-marked
Then you can do one of the following:
$> cat jsonfront.md | jmm
$> cat jsonfront.md | jmm --parse
which will print the parsed output to the terminal
$> cat jsonfront.md | jmm > htmlified.json
$> cat jsonfront.md | jmm --parse > htmlified.json
$> cat htmlified.json
cli
- json2markdown
USAGE - From cli
$> cat jsonfront.md | jmm --serialize
which will print the serialized output to the terminal
$> cat jsonfront.md | jmm --serialize > jsonfront.md
$> cat jsonfront.md
[jsonfront.md]
---{ "name": "Metadata", "CONTENT": [ "pitch", "news", "requirements", "program", "schedule", "support", "contribute", "about" ]}--- # Metadata of content