Skip to content
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

Is there a way to have an option to not escape the contents of <textarea>? #116

Open
chan-dev opened this issue Aug 9, 2020 · 0 comments

Comments

@chan-dev
Copy link

chan-dev commented Aug 9, 2020

I'm trying to get a clean reader view of a website and when a website has a markdown content (i.e https://domchristie.github.io/turndown/) w/c happens to be inside a <textarea> tag, it escapes it w/c in my case is not what i need. I know this library escapes <textarea> content since it may be vulnerable to security issues

For example: trying to library on this https://domchristie.github.io/turndown/ will result in with escaped values resulting to incorrect markdown display

<div class="row"><span>
  </span><p>
    <label for="input">HTML</label>
    <textarea cols="100" rows="10" id="input">&lt;h1&gt;Turndown Demo&lt;/h1&gt;

&lt;p&gt;This demonstrates &lt;a href="https://github.com/domchristie/turndown"&gt;turndown&lt;/a&gt; – an HTML to Markdown converter in JavaScript.&lt;/p&gt;

&lt;h2&gt;Usage&lt;/h2&gt;

&lt;pre&gt;&lt;code class="language-js"&gt;var turndownService = new TurndownService()
console.log(
  turndownService.turndown('&lt;h1&gt;Hello world&lt;/h1&gt;')
)&lt;/code&gt;&lt;/pre&gt;

&lt;hr /&gt;

&lt;p&gt;It aims to be &lt;a href="http://commonmark.org/"&gt;CommonMark&lt;/a&gt;
 compliant, and includes options to style the output. These options include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;headingStyle (setext or atx)&lt;/li&gt;
  &lt;li&gt;horizontalRule (*, -, or _)&lt;/li&gt;
  &lt;li&gt;bullet (*, -, or +)&lt;/li&gt;
  &lt;li&gt;codeBlockStyle (indented or fenced)&lt;/li&gt;
  &lt;li&gt;fence&lt;/li&gt;
  &lt;li&gt;emDelimiter (_ or *)&lt;/li&gt;
  &lt;li&gt;strongDelimiter (** or __)&lt;/li&gt;
  &lt;li&gt;linkStyle (inlined or referenced)&lt;/li&gt;
  &lt;li&gt;linkReferenceStyle (full, collapsed, or shortcut)&lt;/li&gt;
&lt;/ul&gt;</textarea>
  </p><span>
  </span><p>
    <label for="output">Markdown</label>
    <textarea readonly="" cols="100" rows="10" id="output"></textarea>
  </p><span>
</span></div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant