-
Notifications
You must be signed in to change notification settings - Fork 649
Add support for rendering alerts in README #11441
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
Conversation
5ab7ab3
to
364dd2b
Compare
49e99ee
to
0bec9ee
Compare
Currently, alert icon support is handled via pure CSS for the following reasons:
There's also an alternative solution which doesn't require serving the SVG icon via CSS. This might require parsing the sanitized document and inserting the SVG into it. |
@@ -429,7 +443,7 @@ mod tests { | |||
#[test] | |||
fn text_with_forbidden_class_attribute() { | |||
let text = "<p class='bad-class'>Hello World!</p>"; | |||
assert_snapshot!(markdown_to_html(text, None, ""), @"<p>Hello World!</p>"); | |||
assert_snapshot!(markdown_to_html(text, None, ""), @r#"<p class="">Hello World!</p>"#); |
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.
This seems to be caused by the allowed_classes
. I'm not sure if there's any way to get around it.
LGTM, though in the screenshot it looks like there is a lot of padding at the bottom of the alert. is that intentional? I couldn't find anything in the CSS that would explicitly set it like this. 🤔 |
Ah, good catch! It shouldn't have a |
0bec9ee
to
2c8ff86
Compare
2c8ff86
to
26d3e61
Compare
Thanks for the review! All the feedback should be addressed now. (I also rebased to the latest) :D |
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.
that looks better, thanks! :)
This PR continues the work on #10429 and makes it functional by adding
allowed_classes
. This ensures that the generated alert blocks won't be cleaned by the sanitizer. Tests have also been added to confirm everything works as expected.Thanks, @kbdharun, for the work on #10429.
preview:

