Support for AsciiDoc in addition to Markdown

Carl Jacobsen's Avatar

Carl Jacobsen

16 May, 2021 08:45 PM

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?

  1. Support Staff 1 Posted by Brett on 17 May, 2021 10:52 AM

    Brett's Avatar

    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 return NOCUSTOM on STDOUT and it will fall back to whatever internal processor you choose.

    I can help modify a Custom Processor if needed.

    -Brett

  2. 2 Posted by Sebastian David... on 27 Jan, 2022 09:54 AM

    Sebastian Davids's Avatar

    Is there a reason why AsciiDoc support does not come build-in, i. e. no fiddling around with a custom processor?

  3. Support Staff 3 Posted by Brett on 27 Jan, 2022 11:25 AM

    Brett's Avatar

    Because it’s a Markdown previewer.

    -Brett
    ________________________________

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