Add Markdown support to basic Text widget (Lit).#998
Add Markdown support to basic Text widget (Lit).#998ditman wants to merge 6 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Lit renderer to version 0.8.5, introducing markdown support for the Text widget and a new Context.markdown API for dependency injection. It adds a MarkdownDirective that utilizes unsafeHTML and until for asynchronous rendering, along with corresponding tests and sample updates. Feedback suggests improving the logic for prepending markdown heading symbols to prevent redundant formatting when the input text already contains them.
| switch (props.variant) { | ||
| case "h1": | ||
| return html`<h1>${props.text}</h1>`; | ||
| markdownText = `# ${markdownText}`; |
There was a problem hiding this comment.
Is this the best we can do here? I figured the <h1> etc approach would be more correct, and handle multi-line strings correctly? I don't feel strongly if this is what we've done previously and it's fine.
I filed #999 to suggest removing the variant in v0.10 :-D
There was a problem hiding this comment.
Gemini suggested to try to detect if the agent is already passing markdown and handle that. I really want the bug from actual users to roll in. This is what we're currently doing in v0.8 :)
Description
Adds Markdown support to the basic Text widget of the v0_9 Lit renderer.
(This is a very similar, but separate, implementation to what exists in v0.8 today. Adds a couple of tests to the directive.)
Also modifies the demo:gallery09 to inject a Markdown renderer for testing.
Pre-launch Checklist
If you need help, consider asking for advice on the discussion board.