Question test

This commit is contained in:
Ian Gulliver
2026-10-16 07:24:14 -07:00
parent 55f6a7e424
commit 9a7de4c4b2
3 changed files with 5 additions and 12 deletions
+2 -5
View File
@@ -213,22 +213,19 @@ function item(body, opts) {
const target = picker ? detail : li; const target = picker ? detail : li;
const first = picker ? [] : [body[0]]; const first = picker ? [] : [body[0]];
const rest = body.slice(1); const rest = body.slice(1);
if (rest.every((l) => !startsBlockLine(l)) && !rest.includes("")) { if (rest.every((_, n) => !startsBlock(body, n + 1)) && !rest.includes("")) {
target.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts)); target.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts));
return li; return li;
} }
const head = first; const head = first;
let k = 1; let k = 1;
while (k < body.length && body[k] !== "" && !startsBlockLine(body[k])) { while (k < body.length && body[k] !== "" && !startsBlock(body, k)) {
head.push(body[k].trim()); head.push(body[k].trim());
k++; k++;
} }
target.append(...joinLines(head, opts), ...blocks(body.slice(k), opts)); target.append(...joinLines(head, opts), ...blocks(body.slice(k), opts));
return li; return li;
} }
function startsBlockLine(line) {
return fence.test(line) || heading.test(line) || quote.test(line) || bullet.test(line) || ordered.test(line);
}
function cells(line) { function cells(line) {
let s = line.trim(); let s = line.trim();
if (s.startsWith("|")) { if (s.startsWith("|")) {
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -6
View File
@@ -243,13 +243,13 @@ function item(body: string[], opts: Options): HTMLElement {
const target = picker ? detail : li; const target = picker ? detail : li;
const first = picker ? [] : [body[0]!]; const first = picker ? [] : [body[0]!];
const rest = body.slice(1); const rest = body.slice(1);
if (rest.every((l) => !startsBlockLine(l)) && !rest.includes("")) { if (rest.every((_, n) => !startsBlock(body, n + 1)) && !rest.includes("")) {
target.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts)); target.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts));
return li; return li;
} }
const head: string[] = first; const head: string[] = first;
let k = 1; let k = 1;
while (k < body.length && body[k] !== "" && !startsBlockLine(body[k]!)) { while (k < body.length && body[k] !== "" && !startsBlock(body, k)) {
head.push(body[k]!.trim()); head.push(body[k]!.trim());
k++; k++;
} }
@@ -257,10 +257,6 @@ function item(body: string[], opts: Options): HTMLElement {
return li; return li;
} }
function startsBlockLine(line: string): boolean {
return fence.test(line) || heading.test(line) || quote.test(line) || bullet.test(line) || ordered.test(line);
}
function cells(line: string): string[] { function cells(line: string): string[] {
let s = line.trim(); let s = line.trim();
if (s.startsWith("|")) { if (s.startsWith("|")) {