enable headers to have inline sub-elements
This commit is contained in:
parent
b016f77c51
commit
bc031e8639
@ -29,14 +29,14 @@ export function create_renderer(opts: MarkdownOptions) {
|
|||||||
|
|
||||||
function heading(renderer: marked.Renderer, opts: MarkdownOptions) {
|
function heading(renderer: marked.Renderer, opts: MarkdownOptions) {
|
||||||
return function(orig_text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string) {
|
return function(orig_text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string) {
|
||||||
let { text, id, html_attrs } = parse_attributes(raw);
|
let { text, id, html_attrs } = parse_attributes(orig_text);
|
||||||
if (id) {
|
if (id) {
|
||||||
text += `\n<a class="heading-anchor" href="#${id}">`
|
text += `\n<a class="heading-anchor" href="#${id}">`
|
||||||
+ `\n\t\t${icons.link}`
|
+ `\n\t\t${icons.link}`
|
||||||
+ `\n\t\t<span style="display: none">Section titled ${text}</span>`
|
+ `\n\t\t<span style="display: none">Section titled ${text}</span>`
|
||||||
+ `\n\t</a>`;
|
+ `\n\t</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `\n<h${level} ${html_attrs.join(' ')}>\n\t${text}\n</h${level}>`;
|
return `\n<h${level} ${html_attrs.join(' ')}>\n\t${text}\n</h${level}>`;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user