medfreeman / markdown-it-toc-and-anchor

markdown-it plugin to add a toc and anchor links in headings
MIT License
60 stars 35 forks source link

How to use it in browser? #35

Open tamlok opened 7 years ago

tamlok commented 7 years ago

Hi, could you help me with using it in browser directly? Thanks very much!

medfreeman commented 7 years ago

Hi, sure.

What is your current code ? What errors do you get ? Did you try the example here (look for the browser example) ?

tamlok commented 7 years ago

Thanks for your response! I am new to npm. I see other markdown-it plugins have a dist/ directory which contains the *.js file for use in browser.

I tried to use browserify to make one JS file for markdown-it-toc-and-anchor according to some examples on the Web. But it complains some errors. After struggling for a while, I turn to other plugins. :)

So I think we could release a dist/ direcotry and corresponding JS files which could be directly used in browser, for example, making it as simple as using window.markdowitTocAndAnchor.

Thanks very much!

john-cj commented 5 years ago

@tamlok Did you ever success in getting this to work? For some reason, the browserified version of this plugin doesn't work for me too. Another plugins, with Browserify, works fine for me (so, I know how to use Browserify).

tamlok commented 5 years ago

@john-cj Nope! As what I said, I went for another similar project.