Compare commits

...

2 Commits

Author SHA1 Message Date
704447f7c0
0.2.1 2023-05-18 21:27:16 -07:00
e40db445a5
disable newly deprecated stuff 2023-05-18 21:27:09 -07:00
4 changed files with 6 additions and 9 deletions

4
package-lock.json generated
View File

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

View File

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

View File

@ -30,6 +30,8 @@ export async function render_markdown_to_html(markdown: string, options: Markdow
async: true,
breaks: options.breaks || false,
renderer: create_renderer(options),
mangle: false,
headerIds: false,
};
marked.use({

View File

@ -28,14 +28,9 @@ 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, slugger) {
return function(orig_text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string) {
let { text, id, html_attrs } = parse_attributes(raw);
if (! id) {
id = slugger.slug(text);
html_attrs.push(`id="${id}"`);
}
return `
<h${level} ${html_attrs.join(' ')}>
${text}