evilstreak / markdown-js

A Markdown parser for javascript
7.69k stars 863 forks source link

Maruku dialect Meta #167

Closed aleray closed 10 years ago

aleray commented 10 years ago

Hi,

I'm interested in the meta feature of the maruku dialect. I don't know how to get back the metadata though. Could you provide an exemple?

Thanks,

Alex

evilstreak commented 10 years ago

I've added links out to the docs for each dialect to the README: https://github.com/evilstreak/markdown-js/commit/7051ac69414fd6cf839c17d4a1a9e9c9aac3ed05

All of the metadata will be available in the JsonML tree after parsing. E.g.

> var md = require('./lib/markdown.js')
> md.parse('hello world\n{:#id .class foo=bar}', 'Maruku')
[ 'markdown',
  [ 'para',
    { id: 'id',
      class: 'class',
      foo: 'bar' },
    'hello world' ] ]
aleray commented 10 years ago

Thanks,

I figured out after sending my message that the exemple with link references in the main README file would work.

I was confused because I read in https://github.com/evilstreak/markdown-js/pull/76 that one could do

md.toHTML(str.toString(),'Maruku').meta.subject

Anyway, going trough the JSONML sounds very fine.