0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-06-22 02:48:40 +00:00

Merge branch 'master' of https://github.com/naturalcrit/homebrewery into add-image-preview

This commit is contained in:
Víctor Losada Hernández
2026-05-10 19:10:23 +02:00
11 changed files with 623 additions and 524 deletions
@@ -16,6 +16,7 @@ const customTags = {
definitionTerm : 'definitionTerm', // .cm-definitionTerm
definitionDesc : 'definitionDesc', // .cm-definitionDesc
definitionColon : 'definitionColon', // .cm-definitionColon
strikethrough : 'strikethrough', // .cm-strikethrough
//CSS
@@ -81,6 +82,23 @@ export function tokenizeCustomMarkdown(text) {
}
}
// --- Strikethrough ---
if(/\~/.test(lineText)) {
const strikethroughRegex = /~(?!\s)(.+?)(?<!\s)~/g;
let match = strikethroughRegex.exec(lineText);
let type = customTags.strikethrough;
if(match) {
tokens.push({
line : lineNumber,
type,
from : match.index,
to : match.index + match[0].length,
});
}
}
// --- single line def list ---
const singleLineRegex = /^(?=.*[^:])(.+?)(\s*)(::)([^\n]*)$/dmy;
const match = singleLineRegex.exec(lineText);
@@ -190,7 +208,7 @@ export function tokenizeCustomMarkdown(text) {
tokens.push({
line : lineNumber,
from : match.indices[1][0],
to : match.indices[1][0] + match[1].length,
to : match.indices[1][1],
type : customTags.injection,
});
}