Stop Marked from converting characters to HTML

Ross's Avatar

Ross

02 May, 2012 09:23 AM

Is there a way to stop Marked from converting < > " ' etc. to HTML? I use Markdown in conjunction with my CMS, which uses a number of HTML like tags to output images and links to files that are stored within the CMS. A typical document would look something like this:

# Hello World ## Do you know where your towel is?

<txp:image id="24" />

Nulla vitae elit libero, a **pharetra** augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<txp:file_download id="10" />

Unfortunately my txp: tags get converted to the following (which my CMS does not understand) when I copy the HTML to the clipboard

<txp:image id=“24” /> <txp:file_download id=“10” />

Failing that is there a way to stop Marked converting them when it encounters the txp: prefix?

  1. 1 Posted by Ross on 02 May, 2012 09:26 AM

    Ross's Avatar

    Sorry that should be:

    &lt;txp:image id=&#8220;24&#8221; /&gt;'<txp:file_download id=“10” />`

    I forgot to wrap them as a code block.

  2. 2 Posted by Ross on 02 May, 2012 09:29 AM

    Ross's Avatar

    Sorry that should be:

    &lt;txp:image id=&#8220;24&#8221; /&gt; &lt;txp:file_download id=&#8220;10&#8221; /&gt;

    I forgot to wrap them as a code block.

  3. Support Staff 3 Posted by Brett on 02 May, 2012 01:25 PM

    Brett's Avatar

    Marked's processor only recognizes block level html elements. To do it with the current version would require you add additional markup that I don't think would be appropriate. I'll consider adding txp tags to the processors do-not-convert list, but it's an edge case and most people _want_ unrecognized tags to be escaped. I'll keep you posted.

  4. 4 Posted by Ross on 02 May, 2012 02:15 PM

    Ross's Avatar

    Thank you very much.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac