Repository navigation
markdown: escape alt text in images #2478
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,17 @@ String escapeHtml(String html, {bool escapeApos = true}) => HtmlEscape( | |
| String escapeHtmlAttribute(String text) => | ||
| const HtmlEscape(HtmlEscapeMode.attribute).convert(text); | ||
|
|
||
| /// Escapes raw `"` (double quote), `'` (single quote), `<` (less than) and | ||
| /// `>` (greater than) characters. | ||
| /// | ||
| /// Unlike [escapeHtmlAttribute], this does not escape `&` (ampersand) to | ||
| /// avoid double-escaping already-escaped HTML entities. | ||
|
Comment on lines
+29
to
+30
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it that we end up with somethign here which is partially escaped? Where would we have escaped
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is awkward. By the time the alt text has been put into an element's This escaping is done early because we parse the alt text into more inline nodes, which is allowed by the spec. The spec allows, for example |
||
| String escapeAttributeCharactersValue(String text) => text | ||
| .replaceAll('"', '"') | ||
| .replaceAll("'", ''') | ||
| .replaceAll('<', '<') | ||
| .replaceAll('>', '>'); | ||
|
kevmoo marked this conversation as resolved.
Resolved
|
||
|
|
||
| /// "Normalizes" a link label, according to the [CommonMark spec]. | ||
| /// | ||
| /// [CommonMark spec] https://spec.commonmark.org/0.30/#link-label | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.