feat(callout): callout block pipeline with config-driven endering#88
Open
sospartan wants to merge 2 commits into
Open
feat(callout): callout block pipeline with config-driven endering#88sospartan wants to merge 2 commits into
sospartan wants to merge 2 commits into
Conversation
…endering - New BlockKind.callout in BlockParser, detected before blockquote via static var calloutTypes injection point (no method signature changes) - Config-driven colors and icons via CalloutConfiguration + CalloutStyle - Single token per block (like codeBlock) for consistent paragraph expansion - Title always visible text; [!TYPE] marker hidden in render mode, revealed while editing - Icon vertically centered on text baseline; edit mode omits icon indent - Empty-title line height maintained via base font on hidden marker area - Callout background: plain rectangle fill + left color accent bar - Activation: BlockParser.calloutTypes set once in NativeTextViewWrapper
Contributor
Author
|
@luca-chen198
I'm relieved the #87 wasn't merged, as it felt rough and poorly structured. This version is much cleaner, I think. I hope this is a step forward, and I'm definitely open to further feedback! |
- Inject BlockParser.calloutTypes before each callout test - Title is always visible (bold + bodyText), not hidden - [!TYPE] marker still hidden (clear) when inactive, muted when editing
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.
Summary
Adds config-driven callout block support as a standalone pipeline, entirely
separate from blockquotes. Embedders supply type-to-color+icon mappings via
CalloutConfiguration, and the engine renders GFM-style callouts withbackground fill, colored accent bar, and SF Symbol icons.
Problem
The previous callout implementation on
localwas tied to blockquote styling— detection happened inside
styleBlockquote()via regex, making the featurehard to isolate, test, and review independently.
Solution
A dedicated
BlockKind.calloutinBlockParser, activated by a single staticinjection point (
BlockParser.calloutTypes). No method signatures changeanywhere in the parser/styler/tokenizer pipeline.
calloutInfo()hand-scanner classifies> [!TYPE]lines beforeisBlockquote()incomputeBlockscodeBlock), so incremental editingnaturally expands to the full callout range via
tokenRestyleParagraphsstyleCallout()independent ofstyleBlockquote(); title alwaysvisible,
[!TYPE]marker hidden in render mode(no rounded corners, no overlay title)
CalloutConfigurationwithCalloutStyle(color:icon:)per type;.nonedefault preserves backward compatibility