markdown-it / markdown-it-container

Fenced container plugin for markdown-it markdown parser
MIT License
496 stars 74 forks source link

How to use in browser #2

Closed syarul closed 8 years ago

syarul commented 8 years ago

How to use this in browser instead using require module. I try this but doesn't seem to work

var container = window.markdownitContainer;
md.use(container);
puzrin commented 8 years ago

It should work. Try to create a demo example.

puzrin commented 8 years ago

https://github.com/markdown-it/markdown-it/commit/404c78290a4d275492be4d2a809328da95f75c98 i think you missed plugin options. That's not browser-related issue. Make sure it works in node first.

syarul commented 8 years ago

Yeah I got it working by adding the class option

md.use(container, 'tab')

Sorry this maybe a different question, still figuring out how to handle multiple nested class, lasttab will be the child of anothertab but how make it child of tab?

::: tab
::: anothertab
:::lasttab
content
:::
puzrin commented 8 years ago

Add more :::::: to outer block. Nesting is the same as for fenced blocks.

http://spec.commonmark.org/0.22/#fenced-code-blocks

syarul commented 8 years ago

oh thanks @puzrin that save me a lot!

puzrin commented 8 years ago

example

isTravis commented 8 years ago

This is amazingly helpful and not necessarily obvious from the README if you don't know the commonmark specification of fenced blocks.

It may be useful for others to have a quick note (and perhaps link to the example) describing nested containers.

Thanks for all your work on this plugin!