And, it doesn't look like the built-in Permalink functions (headerLink, linkInsideHeader, linkAfterHeader) return strings either?
So, what string am I supposed to return in my custom function renderPermalink (slug, opts, state, idx) {}?
More Details...
I'm using VuePress, and I want to configure my own custom permalink, using the permalink option for markdown-it-anchor.
The types for markdown-it-anchor show that a PermalinkGenerator should return a string
However, the docs for custom permalinks don't show a return type, so I'm getting an ESLint error because I don't return a string in my custom function...
(property) anchor.AnchorOptions.permalink?: anchor.PermalinkGenerator
Type '(slug: string, opts: PermalinkOptions, state: StateCore, idx: number) => void' is not assignable to type 'PermalinkGenerator'.
Type 'void' is not assignable to type 'string'.ts(2322)
If I return a random string, that satisfies ESLint and the permalink still renders <div>test</div>, so should I just return an empty string?
Hello!
TL;DR --
The types say that my custom
PermalinkGenerator
should return astring
: https://github.com/valeriangalliat/markdown-it-anchor/blob/master/types/index.d.ts#L39But, the docs for custom permalinks don't show a return type: https://github.com/valeriangalliat/markdown-it-anchor#custom-permalink
And, it doesn't look like the built-in Permalink functions (
headerLink
,linkInsideHeader
,linkAfterHeader
) return strings either?So, what
string
am I supposed to return in my customfunction renderPermalink (slug, opts, state, idx) {}
?More Details...
I'm using VuePress, and I want to configure my own custom permalink, using the
permalink
option formarkdown-it-anchor
.The types for
markdown-it-anchor
show that aPermalinkGenerator
should return a stringHowever, the docs for custom permalinks don't show a return type, so I'm getting an ESLint error because I don't
return
astring
in my custom function...If I return a random
string
, that satisfies ESLint and the permalink still renders<div>test</div>
, so should I just return an empty string?