Skip to content

Enhance configuration support#143

Merged
LiYanan2004 merged 13 commits intoLiYanan2004:mdv3from
hra42:mdv3
Mar 10, 2026
Merged

Enhance configuration support#143
LiYanan2004 merged 13 commits intoLiYanan2004:mdv3from
hra42:mdv3

Conversation

@hra42
Copy link

@hra42 hra42 commented Mar 6, 2026

Hi @LiYanan2004,

I saw that a longer time nothing has happend in the mdv3 branch, but I really needed the changes you already made. I did some more work and I already shipped in Prod today. If you'd like me to, I'd be happy to support with the remaining tasks of version 3. Below is a summary of the changes made by Copilot.


This pull request introduces enhancements to the Markdown rendering system, focusing on improved heading styling, support for checkbox rendering in lists, and minor logic adjustments. The key changes are grouped below:

Heading Styling Improvements

  • Added headingStyleGroup to MarkdownRendererConfiguration, enabling customizable heading styles for Markdown headings. This is now passed through the environment and used in MarkdownView and heading rendering logic. [1] [2] [3]
  • Updated heading rendering in CmarkTextContentVisitor to apply the appropriate style and font from headingStyleGroup, and improved accessibility support.

Checkbox Rendering in Lists

  • Modified list item rendering in CmarkTextContentVisitor to support checkboxes: if a list item has a checkbox, it displays a corresponding icon instead of a marker. [1] [2] [3]

Logic Adjustment

  • Changed the order of math range parsing in MathFirstMarkdownViewRenderer to process ranges in reverse, improving math rendering consistency.

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@LiYanan2004
Copy link
Owner

Thanks for your contribution! I am busy on other projects and my personal stuffs so there might need to be extra delays on this project

@hra42
Copy link
Author

hra42 commented Mar 6, 2026

Did some performance improvements and solved #135

Allows consumers to force a specific renderer (e.g. .view) via
.environment(\.markdownViewRenderer, .view), which is needed for
SwiftUI ImageRenderer compatibility on macOS 26+.
Copy link
Owner

Choose a reason for hiding this comment

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

To avoid data corruption, we should only keep single source-of-truth. But there are two.

I know there is a flag but the reason for switching to an ObservableObject is to be able to share the content across view hierarchy so for MarkdownView, it must use ObservedObject (the object is passed either from parent view or from MarkdownReader

.makeBody(content: content, configuration: configuration)
.erasedToAnyView()
.font(configuration.fonts[.body] ?? Font.body)
var config = configuration
Copy link
Owner

Choose a reason for hiding this comment

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

It's better to modify the existing view modifier

/// produced it. Because this is a reference type stored in `@State`, it
/// persists across body evaluations without triggering additional renders.
@MainActor
private final class RenderCache {
Copy link
Owner

Choose a reason for hiding this comment

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

The current (in v2 as well) is not efficient. Caches are rarely hit. I will implement a new approach later

Copy link
Owner

@LiYanan2004 LiYanan2004 left a comment

Choose a reason for hiding this comment

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

I will help revert some of these changes and merge it. Thanks

@LiYanan2004
Copy link
Owner

Thank you for your amazing work! @hra42

@LiYanan2004 LiYanan2004 merged commit 40da6a1 into LiYanan2004:mdv3 Mar 10, 2026
5 checks passed
@LiYanan2004 LiYanan2004 changed the title Enhance MathFirstMarkdownViewRenderer with configuration support Enhance configuration support Mar 10, 2026
@hra42
Copy link
Author

hra42 commented Mar 10, 2026

Thank you for your amazing work! @hra42

If you need further help with anything just send me to it :) Will help as much as possible :)

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.

2 participants