Including unprocessed text with linking to a file

Michael Morrison's Avatar

Michael Morrison

30 Sep, 2014 05:50 PM

Hello!

I would like to include some text (Wordpress short codes) in a document and have Marked pass the text exactly, without processing, and without embedding in <code> tags. I see that I can do this by linking to a second file, but I would like to do this directly, within a single document. Is there a way to tell Marked to ignore a section of text in a document?

Thanks!

Michael

  1. 1 Posted by Michael Morriso... on 30 Sep, 2014 05:51 PM

    Michael Morrison's Avatar

    Ooops.. Title should have read "without linking to a file". Sigh.

  2. Support Staff 2 Posted by Brett on 30 Sep, 2014 06:44 PM

    Brett's Avatar

    Not by default. You could have a simple custom processor that replaced
    them with placeholders, ran a markdown processor, and then replaced
    them.

    If you're outputting to HTML and pasting that to your blog, you can
    always escape the first square bracket (\[shortcode]), which should keep
    a Markdown processor from doing anything to it and the slash wouldn't
    show up in the export. It would be wrapped in <p> tags, though.

    -Brett

  3. 3 Posted by Michael Morriso... on 30 Sep, 2014 07:36 PM

    Michael Morrison's Avatar

    Hello Brett,

    Thanks for your quick reply!

    I tried the backslash, and find that WP is still choking on the converted characters. So,

    `[caption id="attachment_314" align="aligncenter"`

    is converted to

    `[caption id=&#8220;attachment_314&#8221; align=&#8220;aligncenter&#8221;`

    And WP becomes confused. So it looks like I need to send the whole section of text, unprocessed, and not just suppress the first "[". Yes, it does wrap in <p> tags, but this doesn't seem to be the problem...

    If you have further thoughts, I look forward to hearing them!

    Many thanks,

    Michael

  4. Support Staff 4 Posted by Brett on 30 Sep, 2014 08:30 PM

    Brett's Avatar

    What I recommend is putting this plugin on your wordpress blog and just
    posting the Markdown itself after previewing:
    https://wordpress.org/plugins/markdown-on-save-improved/

    It saves the HTML and the Markdown at the same time, so you can edit
    your post in MD and still not have to render it on the front end for
    every page load.

    -Brett

  5. 5 Posted by Michael Morriso... on 30 Sep, 2014 10:39 PM

    Michael Morrison's Avatar

    Thanks Brett!

    I'll see what I can do!

    Does it make sense to have such a capability? A syntax that says, "don't render this text, but stick it in just like it is"?

    Thanks so much for Marked, which I use every day!

    Michael

  6. Support Staff 6 Posted by Brett on 30 Sep, 2014 11:19 PM

    Brett's Avatar

    You can use divs to do it. I didn't think about that. Use:

    <div markdown="0">

    [shortcode]

    </div>

    If you turn off "Process Markdown inside of HTML" in the Processor
    preferences, it won't even wrap the p tags. It's an extra div in the
    markup output, but it won't be visible on the front end.

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