Skip to content

fix(export): a quote holding a list does not fail the HTML export - #13771

Closed
yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/export-html-quote-list
Closed

yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/export-html-quote-list

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

HTML export of a block whose quote holds a list (> * x, > 1. x, or * x inside #+BEGIN_QUOTE) fails with the string "Insert at top".

block-quote in frontend/handler/export/html.cljs built the quote's content in a zipper rooted at a bare [:blockquote]. The zipper's branches are :ul nodes, so that root has no children to move to. A paragraph inside the quote works, because it only edits the root node. A list calls add-next-level-ul-at-right on the root, and clojure.zip/insert-right at the root throws "Insert at top".

The fix builds the quote's content in a zipper rooted like the page's ([:ul [:placeholder]]), and puts the placeholder's items and the nodes after it into [:blockquote ...]. A quote holding paragraphs exports as before.

export-helper is split into export-hiccup, which builds the hiccup, and the rendering. The tests check the hiccup, because the rendering's pretty-print step uses the browser's DOMParser, which Node does not have.

Found by a fuzzer that exports random Markdown as text, HTML and OPML.

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Combined with the other PRs that change the same files into #13784.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant