Support for AsciiDoc in addition to Markdown
I've recently started working with AsciiDoc files (using asciidoctor) while continuing to use Markdown for lots of things. I see several descriptions on your site for how to set up Marked to work with asciidoctor, but it appears that this involves changing the custom processor settings, making Marked only useful for AsciiDoc at that point.
I'd love to see something in the settings allowing per-file-extension customization - I'd like to set it so that *.adoc
files get sent through a/the custom processor (asciidoctor with a bunch of command-line options, as detailed on your site), while all the other extensions continue to get processed as Markdown. Can this be done?
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
Support Staff 1 Posted by Brett on 17 May, 2021 10:52 AM
Hi Carl,
Custom processors actually receive a set of environment variables that can be used for exactly this. The one you'd be interested in is
MARKED_EXT
. With that, you can set up any of the asciidoctor custom processors, but have the script check that$MARKED_EXT == "adoc"
before processing as AsciiDoc. If it's not, just returnNOCUSTOM
on STDOUT and it will fall back to whatever internal processor you choose.I can help modify a Custom Processor if needed.
-Brett
2 Posted by Sebastian David... on 27 Jan, 2022 09:54 AM
Is there a reason why AsciiDoc support does not come build-in, i. e. no fiddling around with a custom processor?
Support Staff 3 Posted by Brett on 27 Jan, 2022 11:25 AM
Because it’s a Markdown previewer.
-Brett
________________________________