Switch to reverse_markdown instead of sanitize_html - #55
Conversation
Otherwise, the template may end up on the same line as a preceding environment, e.g., a markdown code environment.
Using `sanitize_html` was causing formatting issues on imported content with
non-trivial formatting. For example, simply dropping tags caused blocks of the
form
<noscript>
some blah blah blah
</noscript>
to be treated and formatted as code blocks, because markdown causes indented
content to be parsed as a code block. Similarly, when a post's entire content is
stored on a single line in the RSS feed, this causes unusual rendering side
effects when tags are deleted, again due to Markdown's convention of treating
continuous blocks of text as paragraphs.
Instead, we use `reverse_markdown` to convert the HTML to Markdown, thereby
preserving the content one cares about (bold/italic, images, tables, lists,
links, etc.), while stripping out the undesirable content (scripts, CSS, etc.).
This has so far proven to be more reliable than the previous HTML sanitization.
It has the added benefit that the entire site, including the aggregated content,
is styled identically.
…o link to the original post
|
Hey @ryanakca, Thank you for the pull request. |
|
Hi @sauron, I'm not particularly sure why universality comes in, since nobody should be editing the Markdown or HTML in the post files planet spits out (these changes only affect files generated by planet). At least, as far as I can tell, any changes made to the files under However, if you'd like to make it an option in the name of backwards compatibility, please feel free :) |
|
@ryanakca, Can you create a gist with an example of the post that was being created in wrong way? That will help me to finish the Test considering this scenario. Thank you. |
Using
sanitize_htmlwas causing formatting issues on imported content withnon-trivial formatting. For example, simply dropping tags caused blocks of the
form
to be treated and formatted as code blocks, because markdown causes indented
content to be parsed as a code block. Similarly, when a post's entire content is
stored on a single line in the RSS feed, this causes unusual rendering side
effects when tags are deleted, again due to Markdown's convention of treating
continuous blocks of text as paragraphs.
Instead, we use
reverse_markdownto convert the HTML to Markdown, therebypreserving the content one cares about (bold/italic, images, tables, lists,
links, etc.), while stripping out the undesirable content (scripts, CSS, etc.).
This has so far proven to be more reliable than the previous HTML sanitization.
It has the added benefit that the entire site, including the aggregated content,
is styled identically.