Centralize a markdown_to_safe_html function
#284
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Now that every summary has a
summary_descriptionfield, plugins willneed to serve rendered Markdown to the frontend (assuming that we don't
want to do Markdown rendering in JavaScript, which we don't). This
has security implications (sanitization), so TensorBoard should expose a
function that does the right thing.
An alternative would be to provide a route that provides rendered
Markdown for the
summary_descriptiononly. This has disadvantages:(1) it would require at least one extra network roundtrip (plugins must
first request the list of tags, then request the rendered description),
(2) it would induce a FoUC-like state where the tags have been fetched
but their metadata has not; and (3) it would not generalize to plugins
that want to safely render other kinds of Markdown, like the text
plugin.
Test Plan:
Run unit tests, and verify that the text and histogram plugins continue
to work.
wchargin-branch: markdown-to-safe-html