HTML in your notes now survives: comments, <details> blocks, <div>s and other raw HTML are kept as written by normalize, formatting in the editor and the write tools instead of being dropped. Queries gain two new block predicates — $comment to find blocks by the HTML comments attached to them, and $html to select (and edit or delete) HTML blocks.
iwe
Added
$commentblock predicate matches blocks by their HTML comments (a comment line after the block, or an inline comment in its text); a string matches the whole comment text and{}matches any commented block$htmlblock predicate selects HTML blocks; their text is the HTML source, and$replaceText,$replaceand$deletework on them
Changed
$textand$matchesblock predicates ignore HTML comments in the block text
Fixed
- HTML comment lines (
<!-- note -->) after a paragraph, heading, list item or quote are kept bynormalizeand other commands (previously dropped) - HTML blocks such as
<div>,<details>and<script>are kept as written bynormalizeand other commands (previously dropped) - Text written as
\<tag>stays escaped instead of turning into a real HTML tag - Raw HTML in djot documents is kept as raw HTML (previously turned into a code block or plain text)
iwes
Fixed
- HTML comment lines (
<!-- note -->) after a paragraph, heading, list item or quote are kept when a document is formatted or changed by a code action (previously dropped) - HTML blocks such as
<div>,<details>and<script>are kept as written when a document is formatted or changed by a code action (previously dropped) - Text written as
\<tag>stays escaped when a document is formatted instead of turning into a real HTML tag
iwec
Added
$commentblock predicate iniwe_queryfilters matches blocks by their HTML comments (a comment line right after the block, or an inline comment in its text)$htmlblock predicate iniwe_queryselects HTML blocks; their text is the HTML source
Changed
iwe_query$textand$matchesblock predicates ignore HTML comments in the block text
Fixed
- HTML comment lines (
<!-- note -->) are kept when write tools rewrite a document (previously dropped) - HTML blocks such as
<div>,<details>and<script>are kept as written when write tools rewrite a document (previously dropped)
Library crates (liwe, diwe)
liwe
Added
Commentvariants onDocumentBlock,DocumentInline,Inline,NodeandGraphNodefor HTML comments (comment lines were previously dropped and inline comments read as plain text)Reference.commentsfield holds the comments written after a block referenceBlockOp::Commentquery operator andBlockPredicate::commentbuilder for the$commentblock predicateHtmlvariants onDocumentBlock(holdingHtmlBlock),Node,GraphNodeandBlockfor HTML blocks, kept as their exact source (previously dropped);GraphNode::CommentandGraphNode::Htmlshare theTextLeafstructBlockType::HtmlandBlockPredicate::htmlbuilder for the$htmlblock predicate
Changed
- Inline HTML is read as
Inline::RawInline("html", ...)(previouslyInline::Str), and the Markdown writer writeshtmlraw inlines as they are (previously as code spans) - Djot raw blocks with the
htmlformat are read asNode::Html(previously code blocks), and the djot writer writes raw inlines as`...`{=format}(previously the bare content)