v0.2.84
This commit is contained in:
1 parent
6329ac33d1
commit
90e3c399ea
22 files changed
+729
-46
No files matched your search
+16
-1
@@ -531,11 +531,27 @@ export function renderMarkdown(source, lineOffset = 0) {
|
||||
|
||||
const heading = line.match(/^\s{0,4}(#{1,6})\s+(.+?)(?:\s+\{#([A-Za-z][\w:.-]*)\})?\s*$/);
|
||||
const listItem = listLine(line);
|
||||
const quote = line.match(/^>\s?(.*)$/);
|
||||
|
||||
if (listItem) {
|
||||
const rendered = renderList(lines, index, lineOffset, listItem.indent, listItem.type);
|
||||
html += rendered.html;
|
||||
index = rendered.end - 1;
|
||||
} else if (quote) {
|
||||
closeList();
|
||||
let quoteBody = "";
|
||||
let quoteIndex = index;
|
||||
while (quoteIndex < lines.length) {
|
||||
const quoteLine = lines[quoteIndex].match(/^>\s?(.*)$/);
|
||||
if (!quoteLine) break;
|
||||
const prefix = lines[quoteIndex].startsWith("> ") ? "> " : ">";
|
||||
const lineAttrs = attrs(quoteIndex, true, prefix, "", lineOffset)
|
||||
.replace(' class="', ' class="markdown-quote-line ');
|
||||
quoteBody += `<div${lineAttrs}>${quoteLine[1] ? inline(quoteLine[1]) : "<br>"}</div>`;
|
||||
quoteIndex++;
|
||||
}
|
||||
html += `<blockquote class="markdown-quote-group">${quoteBody}</blockquote>`;
|
||||
index = quoteIndex - 1;
|
||||
} else if (heading) {
|
||||
closeList();
|
||||
const n = heading[1].length;
|
||||
@@ -555,7 +571,6 @@ export function renderMarkdown(source, lineOffset = 0) {
|
||||
html += `</dl>`;
|
||||
} else if (/^\[PAGEBREAK\]$/i.test(line.trim())) html += `<hr${attrs(index, false, "", "", lineOffset).replace(' class="', ' class="page-break-marker ')} data-page-break="true">`;
|
||||
else if (/^---+$/.test(line.trim())) html += `<hr${attrs(index, false, "", "", lineOffset)}>`;
|
||||
else if (line.startsWith("> ")) html += `<blockquote${attrs(index, true, "> ", "", lineOffset)}>${inline(line.slice(2))}</blockquote>`;
|
||||
else if (line.trim()) html += `<p${attrs(index, true, "", "", lineOffset)}>${inline(line)}</p>`;
|
||||
else html += `<div${attrs(index, true, "", "", lineOffset)}><br></div>`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user