Compare commits

..

No commits in common. "1dcc58c4b24fad3ad0c6a1a520ade3a6c44a2543" and "9b25d2f22c75542b54db7bfe71b73e29fc11cb1c" have entirely different histories.

3 changed files with 12 additions and 10 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@doc-utils/markdown2html",
"version": "0.2.4",
"version": "0.2.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@doc-utils/markdown2html",
"version": "0.2.4",
"version": "0.2.3",
"dependencies": {
"bytefield-svg": "^1.6.1",
"dompurify": "^2.3.6",

View File

@ -1,6 +1,6 @@
{
"name": "@doc-utils/markdown2html",
"version": "0.2.4",
"version": "0.2.3",
"publishConfig": {
"registry": "https://gitea.home.jbrumond.me/api/packages/doc-utils/npm/"
},

View File

@ -30,14 +30,16 @@ export function create_renderer(opts: MarkdownOptions) {
function heading(renderer: marked.Renderer, opts: MarkdownOptions) {
return function(orig_text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string) {
let { text, id, html_attrs } = parse_attributes(raw);
if (id) {
text += `\n<a class="heading-anchor" href="#${id}">`
+ `\n\t\t${icons.link}`
+ `\n\t\t<span style="display: none">Section titled ${text}</span>`
+ `\n\t</a>`;
}
return `\n<h${level} ${html_attrs.join(' ')}>\n\t${text}\n</h${level}>`;
return `
<h${level} ${html_attrs.join(' ')}>
${text}
<a class="heading-anchor" href="#${id}">
${icons.link}
<span style="display: none">Section titled ${text}</span>
</a>
</h${level}>
`;
};
}