Parse and convert bold/italic/underline formatting across document formats#569
Open
LeonarddeR wants to merge 2 commits into
Open
Parse and convert bold/italic/underline formatting across document formats#569LeonarddeR wants to merge 2 commits into
LeonarddeR wants to merge 2 commits into
Conversation
- Add shared document::format_marker_types helper and use it in the odt and word parsers instead of duplicating the bold/italic/underline -> MarkerType fan-out. - Fix O(n^2) per-run rescan in the word parser: track a running display length instead of calling display_len on the whole paragraph for every run. process_hyperlink now returns the display units it appended so offsets stay correct in paragraphs that mix hyperlinks and formatted runs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 inline character-formatting (bold, italic, underline) support end to end:
detection during parsing, an intermediate marker representation, and rendering
in the exporters.
Changes
Bold/Italic/Underlinemarkers into the shared
DocumentBuffer:rtf.rs— RTF control-word toggles with group-scope ({...}) bookkeepingodt.rs— resolvestext:style-nameagainst<office:automatic-styles>(
font-weight/font-style/text-underline-style)word.rs— OOXML run properties (b/i/utoggles)html_to_text.rs/xml_to_text.rs— tag-based formattinghtml.rs—<b>/<i>/<u>via the existing inline open/close eventsmarkdown.rs—**/*; underline is dropped (no CommonMark equivalent)PartialEq/EqonMarkerTypeFfiand adds testcoverage for
get_formatting_markers.