Skip to content

feat: add markdown parsing for ai summaries (#569, #786)#1002

Merged
spacecowboy merged 3 commits intospacecowboy:masterfrom
myaple:summary-markdown
Mar 5, 2026
Merged

feat: add markdown parsing for ai summaries (#569, #786)#1002
spacecowboy merged 3 commits intospacecowboy:masterfrom
myaple:summary-markdown

Conversation

@myaple
Copy link
Contributor

@myaple myaple commented Dec 12, 2025

This PR adds comprehensive markdown rendering capabilities to AI-generated article summaries, transforming plain text responses into properly formatted, visually appealing content.

Let me know what you think and what changes you'd like to see.

Copy link
Owner

@spacecowboy spacecowboy left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me. See one comment about performance issue though.

And sorry for the long delay, I've been busy IRL

Comment on lines +514 to +524
val markdownConverter = remember { MarkdownToHtmlConverter() }
val htmlContent =
remember(summary.value.content) {
markdownConverter.convertToHtml(summary.value.content)
}

// Convert HTML to AnnotatedString for rich text display
val annotatedStrings =
remember(htmlContent) {
htmlStringToAnnotatedString(htmlContent)
}
Copy link
Owner

Choose a reason for hiding this comment

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

You are converting the text to markdown and then annotatedString on the UI-thread.

This should be moved inside ArticleViewModel such that the final annotated string is part of the OpenAISummaryState.Result from the start

@myaple
Copy link
Contributor Author

myaple commented Feb 9, 2026

Overall it looks good to me. See one comment about performance issue though.

And sorry for the long delay, I've been busy IRL

No worries at all, it's in no way a critical feature, just a day to day minor QoL thing.

I've moved the annotated string to the ArticleViewModel and added a field to the Result, and I avoid putting the error string through the markdown parser to avoid mangling it when visualizing. Let me know if that's what you meant or if I'm missing something still.

@myaple myaple requested a review from spacecowboy February 9, 2026 21:37
Copy link
Owner

@spacecowboy spacecowboy left a comment

Choose a reason for hiding this comment

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

LGTM

@spacecowboy spacecowboy merged commit c973eab into spacecowboy:master Mar 5, 2026
9 of 12 checks passed
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