valeriangalliat / markdown-it-anchor

A markdown-it plugin that adds an `id` attribute to headings and optionally permalinks.
The Unlicense
291 stars 72 forks source link

styleOfPermalinks is not a function #96

Closed AleksandrHovhannisyan closed 3 years ago

AleksandrHovhannisyan commented 3 years ago

The documentation here:

https://github.com/valeriangalliat/markdown-it-anchor/#permalinks

Says that you can do this:

const anchor = require('markdown-it-anchor')
const md = require('markdown-it')()

md.use(anchor, {
  permalink: anchor.permalink.styleOfPermalink(permalinkOpts)
})

But this throws an error. Is styleOfPermalink not an actual method we can invoke? If not, what is the correct syntax?

Thanks!

valeriangalliat commented 3 years ago

Ah yeah I meant styleOfPermalink as a placeholder for any of the permalink methods documented below, but that's not necessarily obvious.

I modified the example to have anchor.permalink[styleOfPermalink](permalinkOpts) to make it more clear that it's a variable, and I added a paragraph below saying it needs to be one of the styles documented afterwards.

Let me know if that heps! Cheers :)

AleksandrHovhannisyan commented 3 years ago

Ah, that makes sense, thanks!