Render a choice's whole list item inside its pick box
This commit is contained in:
+9
-2
@@ -220,10 +220,14 @@ function item(body: string[], opts: Options): HTMLElement {
|
||||
li.className = "choice";
|
||||
li.append(picker);
|
||||
}
|
||||
const target = picker ?? li;
|
||||
const first = picker ? [] : [body[0]!];
|
||||
const rest = body.slice(1);
|
||||
if (rest.every((l) => !startsBlockLine(l)) && !rest.includes("")) {
|
||||
li.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts));
|
||||
if (picker && rest.length > 0) {
|
||||
target.append(h("br"));
|
||||
}
|
||||
target.append(...joinLines([...first, ...rest].map((l) => l.trim()), opts));
|
||||
return li;
|
||||
}
|
||||
const head: string[] = first;
|
||||
@@ -232,7 +236,10 @@ function item(body: string[], opts: Options): HTMLElement {
|
||||
head.push(body[k]!.trim());
|
||||
k++;
|
||||
}
|
||||
li.append(...joinLines(head, opts), ...blocks(body.slice(k), opts));
|
||||
if (picker && head.length > 0) {
|
||||
target.append(h("br"));
|
||||
}
|
||||
target.append(...joinLines(head, opts), ...blocks(body.slice(k), opts));
|
||||
return li;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user