Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/utils/render-note-to-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,21 @@ export const renderNoteToHtml = (content: string) => {
markdownConverter.setOption('tables', true); // table syntax
markdownConverter.setOption('strikethrough', true); // ~~strikethrough~~

const transformedContent = content.replace(
let transformedContent = content.replace(
/([ \t\u2000-\u200a]*)\u2022(\s)/gm,
'$1-$2'
); // normalized bullets

// remove tab indentation on paragraphs
// TODO this is very naive and fragile and will break in a lot of cases, such as:
// - different size indentations
// - paragraphs that begin with a number or a list character
// - list characters other than - and *
transformedContent = content.replace(
/\n {4}(([^-*\d]))/g,
'\n   $1'
);

return sanitizeHtml(markdownConverter.makeHtml(transformedContent));
}
);
Expand Down