dtjm / node-multimarkdown

Native MultiMarkdown extension for Node.js
Other
35 stars 9 forks source link

Snippets instead of full documents? #11

Open 13protons opened 10 years ago

13protons commented 10 years ago

There are two features of MMD I'm trying to get to in the node module - snippets and metakeys.

From the MMD docs on , it's these functions:

multimarkdown -s, multimarkdown --snippet multimarkdown -m, multimarkdown --metadata-keys

My goal is to get an html snippet back with a json object containing the document's metadata keys so I can pass that all on to some template logic.

Any suggestions on how to accomplish this?

dtjm commented 10 years ago

Hi @alanguir,

Which version of MMD has those options? I don't see those flags in the version I am currently using for node-multimarkdown. Here is the source I am looking at for the usage of the command-line tool:

static void printUsage() {
    printf("Usage:\
  multimarkdown [OPTION...] [FILE...]\n\
\n\
Help Options:\n\
  -h, --help              Show help options\n\
\n\
Application Options:\n\
  -v, --version           print version and exit\n\
  -o, --output=FILE       send output to FILE (default is stdout)\n\
  -t, --to=FORMAT         convert to FORMAT (default is html)\n\
  -x, --extensions        use all syntax extensions\n\
  --filter-html           filter out raw HTML (except styles)\n\
  --filter-styles         filter out HTML styles\n\
  -c, --compatibility     markdown compatibility mode\n\
  -b, --batch             process multiple files automatically\n\
  -e, --extract           extract and display specified metadata\n\
\n\
Syntax extensions\n\
  --smart --nosmart       toggle smart typography extension\n\
  --notes --nonotes       toggle notes extension\n\
  --process-html          process MultiMarkdown inside of raw HTML\n\
  --nolabels              do not generate id attributes for headers\n\
\n\
Converts text in specified files (or stdin) from markdown to FORMAT.\n\
Available FORMATs:  html, latex, memoir, beamer, odf, opml\n");
}

If you can point me to the docs you are looking at, I can try to see how that might work.

13protons commented 10 years ago

v4.5 -

multimarkdown -help

MultiMarkdown version 4.5 ` multimarkdown [OPTION...] [FILE...]

Options:
-h, --help             Show help
-v, --version          Show version information
-o, --output=FILE      Send output to FILE
-t, --to=FORMAT        Convert to FORMAT
-b, --batch            Process each file separately
-c, --compatibility    Markdown compatibility mode
-f, --full             Force a complete document
-s, --snippet          Force a snippet
--process-html         Process Markdown inside of raw HTML
-m, --metadata-keys    List all metadata keys
-e, --extract          Extract specified metadata
--random               Use random numbers for footnote anchors

-a, --accept           Accept all CriticMarkup changes
-r, --reject           Reject all CriticMarkup changes

--smart, --nosmart     Toggle smart typography
--notes, --nonotes     Toggle footnotes
--labels, --nolabels   Disable id attributes for headers
--mask, --nomask       Mask email addresses in HTML

Available FORMATs: html(default), latex, beamer, memoir, odf, opml, lyx `

13protons commented 10 years ago

This is actually the functionality I was after - just found it after more research:

https://github.com/jprichardson/node-markdown-extra

dtjm commented 10 years ago

Ah I see. Yeah, this is still using peg-multimarkdown so it doesn't have those extra flags. You'd have to upgrade the MMD library to https://github.com/fletcher/MultiMarkdown-4