Including unprocessed text with linking to a file
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
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
1 Posted by Michael Morriso... on 30 Sep, 2014 05:51 PM
Ooops.. Title should have read "without linking to a file". Sigh.
Support Staff 2 Posted by Brett on 30 Sep, 2014 06:44 PM
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 Posted by Michael Morriso... on 30 Sep, 2014 07:36 PM
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=“attachment_314” align=“aligncenter”`
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
Support Staff 4 Posted by Brett on 30 Sep, 2014 08:30 PM
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 Posted by Michael Morriso... on 30 Sep, 2014 10:39 PM
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
Support Staff 6 Posted by Brett on 30 Sep, 2014 11:19 PM
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.