-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AppendMarkdown function to RichText #4869
Conversation
This carries potential risks which we might need to think about or document. Also the interpretation of markdown may depend on what came before it. |
Concatenation of documents - or rather fragments of text that might have markdown elements like lists but aren't full documents per se - was the use case from Discord that made me think of this feature addition. Is there really anything preventing a markdown text from having multiple titles anyway?
I agree though that the API is not intended for piecewise handling of a single markdown document - maybe it needs a naming update to reflect that? |
Yes you can technically have multiple headings, it's the spec that disagrees. Not sure if it's an API naming issue or just documentation. "ParseMarkdown" also requires that it be a full document so we shouldn't need to introduce new naming to reflect that. I agree that fragments are ok, but they do need to be complete in their own right. Maybe that's what the doc needs? |
Updated API doc to include the caveat against processing a single markdown document piecewise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should encourage piece-wise parsing in any way as it's not supported.
widget/markdown.go
Outdated
@@ -29,6 +29,11 @@ func (t *RichText) ParseMarkdown(content string) { | |||
|
|||
// AppendMarkdown parses the given markdown string and appends the | |||
// content to the widget, with the appropriate formatting. | |||
// This API is intended for appending complete markdown documents or | |||
// standalone fragments, and should not be used to parse a single | |||
// markdown document piecewise. Use ParseMarkdown for this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indication that "ParseMarkdown" can work piecewise doesn't seem correct - that code is being used within this helper so I don't know how it could be true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'm sure this will be helpful
Description:
Allows appending additional markdown text to an existing RichText
Fixes #4866
Checklist:
Where applicable: