0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-27 18:58:12 +00:00

final fixes

This commit is contained in:
Víctor Losada Hernández
2026-03-27 12:16:27 +01:00
parent 9edb0e2fc6
commit c0b3a1940f
5 changed files with 7 additions and 17 deletions

View File

@@ -15,17 +15,13 @@ const customTags = {
definitionList : 'definitionList', // .cm-definitionList
definitionTerm : 'definitionTerm', // .cm-definitionTerm
definitionDesc : 'definitionDesc', // .cm-definitionDesc
definitionColon : 'definitionColon',// .cm-definitionColon
definitionColon : 'definitionColon', // .cm-definitionColon
};
export function tokenizeCustomMarkdown(text) {
const tokens = [];
const lines = text.split('\n');
// Track multi-line blocks
const inBlock = false;
const blockStart = 0;
lines.forEach((lineText, lineNumber)=>{
// --- Page / snippet lines ---
if(/^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m.test(lineText)) tokens.push({ line: lineNumber, type: customTags.pageLine });
@@ -92,7 +88,6 @@ export function tokenizeCustomMarkdown(text) {
if(match) {
const [full, term, colons, desc] = match;
let offset = 0;
// Entire line as definitionList
tokens.push({
line : lineNumber,
@@ -131,7 +126,6 @@ export function tokenizeCustomMarkdown(text) {
// multiline def list
if(!/^::/.test(lines[lineNumber]) && lineNumber + 1 < lines.length && /^::/.test(lines[lineNumber + 1])) {
const term = lineText;
const startLine = lineNumber;
const defs = [];
let endLine = startLine;