Skip to content

Parse and convert bold/italic/underline formatting across document formats#569

Open
LeonarddeR wants to merge 2 commits into
trypsynth:masterfrom
LeonarddeR:props
Open

Parse and convert bold/italic/underline formatting across document formats#569
LeonarddeR wants to merge 2 commits into
trypsynth:masterfrom
LeonarddeR:props

Conversation

@LeonarddeR

Copy link
Copy Markdown
Contributor

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

  • Parsers — extract bold/italic/underline and emit Bold/Italic/Underline
    markers into the shared DocumentBuffer:
    • rtf.rs — RTF control-word toggles with group-scope ({...}) bookkeeping
    • odt.rs — resolves text:style-name against <office:automatic-styles>
      (font-weight / font-style / text-underline-style)
    • word.rs — OOXML run properties (b / i / u toggles)
    • html_to_text.rs / xml_to_text.rs — tag-based formatting
  • Exporters — render the markers:
    • html.rs<b> / <i> / <u> via the existing inline open/close events
    • markdown.rs** / *; underline is dropped (no CommonMark equivalent)
  • session.rs — derives PartialEq/Eq on MarkerTypeFfi and adds test
    coverage for get_formatting_markers.

LeonarddeR and others added 2 commits July 3, 2026 22:31
- 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>
@LeonarddeR LeonarddeR marked this pull request as ready for review July 4, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant