Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Automatically escape certain HTML tags #367

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

revin
Copy link
Collaborator

@revin revin commented May 16, 2017

Here's a markdown-it plugin that will automatically escape <iframe>, <script>, <style>, <textarea>, and <title> tags in embedded HTML blocks, the way GH does.

fixes #363

@revin
Copy link
Collaborator Author

revin commented May 16, 2017

Currently a WIP; needs to have a few questions answered:

  • Our tests explicitly check that <script> is allowed when we're executed with sanitize: false. Nothing magic about <script> in particular; it's just an example of something that would be normally stripped out by the sanitizer. So I'm thinking maybe since turning the sanitizer off is, in a way, opting out of 100% strict GH compat, what about skipping this HTML escaping process in the case of sanitize: false?
  • The sanitizer is configured to strip iframes unless they're pointing to youtube URLs. IIRC we still need that capability because the npm docs have embedded YT vids. Is that still the case? It looks like GH compat is to always escape <iframe> tags in HTML blocks no matter what the src points to. Should we implement the GH version, and allow for the {YT-only, unescaped} version via some combination of options?

@revin revin removed this from the 10.0.0 milestone Jun 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTML-wrapped code blocks contents are parsed
1 participant