-
Notifications
You must be signed in to change notification settings - Fork 481
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
Use (safe) markdown instead of raw text in render_multi_or_match_content #32521
Conversation
…multi_or_match_content to markdown
…dicated image syntax
convert all DSL-defined levels using HTML to instead use markdown
@@ -672,7 +673,8 @@ def render_multi_or_match_content(text) | |||
return match_answer_as_embedded_blockly(path) if File.extname(path).ends_with? '_blocks' | |||
return match_answer_as_iframe(path, width) if File.extname(path) == '.level' | |||
|
|||
text | |||
@markdown_renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::Inline) | |||
@markdown_renderer.render(text).html_safe |
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 looks like it will create a new markdown renderer for each instance of each class which includes this module and calls this method, including once for each multi or match script level object. Perhaps it would be better to store it on @@markdown_renderer
, so that it only gets instantiated once for each class which includes this module and calls this method?
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.
oh, good catch!
wrong "rocket-height(seconds) = seconds \* 48" |
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.
remove extraneous \
? if it is needed, I'm curious why its not also needed on line 12.
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.
weird; I'm not sure why this got added, given that it is indeed not needed
…t we want to be resued between instances
Description
To prevent HTML injection in translations.
Also update the content of those DSL levels currently using HTML to use Markdown. Note: a couple of the updated levels do have minor visual changes. Those changes have all been approved by the relevant curriculum team member.
Uses the new inline markdown renderer added in #32573
Also see this gsheet for a breakdown of which DSL levels are using what kind of supported content (text, image, iframe, blockly, html) in the affected fields.
Links
Reviewer Checklist: