feat: add multi-line highlights and comments support#16
Open
mattfinlayson wants to merge 1 commit into
Open
Conversation
Extend the annotation plugin to support highlighting text that spans multiple lines using %%highlight-start:ID%% / %%highlight-end:ID%% markers. - Auto-detect single-line vs multi-line selection: single-line uses existing ==text== syntax, multi-line uses new %% marker syntax - Comments on multi-line highlights stored as inline <!--comment--> after the end marker, consistent with single-line highlight pattern - Add 'Delete annotation at cursor' command for both single and multi-line highlights - Add 'Clear all annotations' command to strip all markers and comments from the document - Update reading mode post-processor to render multi-line highlights - Add .multiline CSS class for block-level highlight styling - Bump version to 1.1.0
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
Extend the annotation plugin to support highlighting text that spans multiple lines and attaching comments to those highlights.
Previously, the plugin only supported single-line
==highlights==. This PR adds multi-line%%highlight-start:ID%%/%%highlight-end:ID%%markers that work across paragraphs.Changes
Multi-line Highlighting
createHighlightCommandnow detects whether the selection spans multiple lines. Single-line uses==text==, multi-line uses%%highlight-start:ID%%..%%highlight-end:ID%%findHighlightsAndCommentsinextension.tsxto detect and render both marker formatspostprocessor.tsxto parse multi-line highlights alongside single-line ones.multilineCSS class for block-level highlight displayComments
<!--comment-->after the end marker (consistent with existing single-line pattern)CommentPopoverUI works for both highlight types without changesEditing & Management
==,%%, and<!---->markers from the documenthandleCommentUpdateVersion
Test Plan
%%highlight-start:ID%%markers appear<!--comment-->appears after end marker==highlights==still work as before