{{ message }}
fix: encode block highlight in Text/OPML/HTML export - #13174
Open
dannyinit wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #8663
Problem
Highlighting a block (right-click bullet → pick a color) is completely dropped when exporting a page as Text, OPML, or HTML. The highlight is stored as the
:logseq.property/background-colorblock property, but that property is marked:hide? true(so it doesn't clutter the properties UI), and export code filters out all:hide? trueproperties, dropping the highlight along with it.Fix
When generating export content, wrap a highlighted block's text in
^^...^^(Logseq's existing inline highlight markup) if the block hasbackground-colorset. This is gated behind a new:encode-highlight-as-mark?option only passed by the actual "Export page" feature, so it does not affect markdown-mirror generation (which shares the same underlyingfile.cljscode). Text and OPML export then just preserve^^...^^as-is (already handled), and HTML export already turns^^...^^into a real<mark>tag, so the block renders as visibly highlighted.Note: this preserves that a block was highlighted, not which of the 7 colors was picked, since
^^text^^has no color parameter. Capturing the exact color would need a new syntax extension, which felt like a separate, larger discussion.Testing
Reproduced and verified manually against a fresh DB graph, including two highlighted blocks in a parent/child structure:
^^text^^, HTML renders<mark>text</mark>for both blocks at both nesting levels.bb dev:lint-and-test: 0 lint errors/warnings, full unit test suite passes (0 failures/errors).