Skip to content

feat markdown rich - #12664

Draft
80avin wants to merge 19 commits into
slint-ui:masterfrom
80avin:feat-markdown-rich
Draft

feat markdown rich#12664
80avin wants to merge 19 commits into
slint-ui:masterfrom
80avin:feat-markdown-rich

Conversation

@80avin

@80avin 80avin commented Jul 27, 2026

Copy link
Copy Markdown

fixes #12648

  • refactor(styled-text): replace StyledTextParagraph with ParagraphBlock enum
  • fixup: ungate rich_text_content, remove dead append_paragraph
  • fixup: handle unclosed heading at end of input
  • feat(core): update StyledText wrapper for ParagraphBlock enum
  • feat(renderer): add heading font-size scaling and horizontal rule rendering
  • test: update tests for ParagraphBlock, headings, and horizontal rules
  • test: add screenshot tests for headings and horizontal rules
  • fixup: multiply rule spacing by scale factor for HiDPI support
  • feat(markdown): add subscript and superscript support
  • feat(markdown): support HTML inline tags <s>, <del>, <i>, <em>, <b>, <strong>
  • feat(markdown): add footnotes, images, and math support
  • feat(markdown): support HTML comments
  • fix: heading spacing, list alignment, H1/H2 underline, table grid rendering
  • fix: block quote indent, table alignments, table spacing
  • feat(markdown): support <sub> and <sup> HTML tags
  • chore: cleanup dead comments and fix InlineHtml in table cells
  • chore: cargo fmt

How it looks at present:
image
image

80avin added 3 commits July 27, 2026 03:48
…k enum

Introduce a ParagraphBlock enum to carry block-level metadata (heading
level, horizontal rule) instead of adding optional fields to the old
flat struct. A shared RichText struct captures the inline-content
pattern for text and heading blocks. Add parser support for headings
and horizontal rules.
@80avin
80avin force-pushed the feat-markdown-rich branch from c361813 to dcd0a81 Compare July 27, 2026 20:16
@CLAassistant

CLAassistant commented Jul 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@80avin
80avin force-pushed the feat-markdown-rich branch from 39b6719 to 9236981 Compare July 27, 2026 21:04
@80avin
80avin force-pushed the feat-markdown-rich branch from 38a8835 to f9712b5 Compare July 28, 2026 04:05

@tronical tronical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The breakdown of the series looks overall quite reasonable. I'd very much appreciate though if you could also break it down in PRs. So just take the first refactoring and make a PR. Then we review it and get it in, then we continue from there. We're reviewing this code as humans :)

@80avin

80avin commented Jul 28, 2026

Copy link
Copy Markdown
Author

Thanks @tronical. I will cleanup and split into another PR before moving out of draft.
The intention behind the early draft is to collect opinions on the larger direction as well as blockers.
Right now, I see following as major blockers or points of discussion:

  • Is the rendering style acceptable ? Note the horizontal line below H1/H2, style of block-quotes, the slight shift in first line of ordered list (the text after 1. starts early than other lines), etc.
  • Blocker: superscript and subscript cannot be implemented using parley as it doesn't support baseline shifting. We may have to move to cosmic-text, which would rewrite/invalidate this PR.
  • Major decision: How to dynamically load images ? Right now, the images are replaced with Alt text but a better support of images will demand wider architectural changes, possibly adding APIs allowing users to handle/load image urls.

Also, I'll be interested in knowing if the larger opinion is to skip these concerns and push a lean PR which only implements few text formatting elements.

@tronical

Copy link
Copy Markdown
Member

Thanks @tronical. I will cleanup and split into another PR before moving out of draft. The intention behind the early draft is to collect opinions on the larger direction as well as blockers. Right now, I see following as major blockers or points of discussion:

  • Is the rendering style acceptable ? Note the horizontal line below H1/H2, style of block-quotes, the slight shift in first line of ordered list (the text after 1. starts early than other lines), etc.

I suggest that we can fine-tune the style when we get to the PRs that implement style. They should come with screenshot tests, so that we can "lock" in the rendering.0

  • Blocker: superscript and subscript cannot be implemented using parley as it doesn't support baseline shifting. We may have to move to cosmic-text, which would rewrite/invalidate this PR.

I don't see us moving to cosmic-text. I suggest to leave out superscript and subscript for now. Perhaps that could be implemented in parley first?

  • Major decision: How to dynamically load images ? Right now, the images are replaced with Alt text but a better support of images will demand wider architectural changes, possibly adding APIs allowing users to handle/load image urls.

I'd say let's cross that bridge when we get to that PR. Each increment of better rich text support provides value as-is, and if one particular feature takes longer than another then that's fine.

Also, I'll be interested in knowing if the larger opinion is to skip these concerns and push a lean PR which only implements few text formatting elements.

I suggest to start with the basis, adjusting the data structures, then perhaps headings as a start, and then take it from there.

I suggest to use a tracking issue (that you can also edit as you like) so that we can all see what has landed and what's still missing.

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.

Add heading, image, etc support to @markdown

3 participants