Overriding Content Format Markup Identifiers

Hugo supports several different Content Formats. Supported content formats include Goldmark, AsciiDoc and HTML. Each format contains a set of pre-defined markup identifiers as noted in the docs. Markup identifiers establish which formatter will be used given the file extension of a piece of content. For example, given a content file with the ad extension, Hugo will attempt to shell out to asciidoctor.

In my current use case I am attempting to process historical file archives predating AsciiDoc and containing filenames such as toxicnet.ad. Given the file extension of ad Hugo attempts to process the textfile using asciidoctor which is undesirable and, in my case, causes the Hugo build to abend. Given these are historical files being processed modifying them to work around the Hugo behavior is out of the question.

Attempts to create a media type with ad extension in order to override the AsciiDoc markup identifier were unfruitful. Given these observations the current design of content formats also seems to prohibit which suffixes may be used on new custom media types, leading Hugo to be less flexible.

Is there a way to override predefined content format markup identifiers or disable content formats so the historic files mentioned may be processed as plain text or processed in a custom way as suggested for .txt files last month?

my 2c

hugo shells out asciidoc command, put hugo in a shell file and replace asciidoc in this shell

For Linux read this https://www.cyberciti.biz/faq/ignore-shell-aliases-functions-when-running-command/

If you are under WIndows or Mac, ask google

It’s hacky but it sounds like a good workaround. I’m running Arch. Thank you for the link.

Following up, it seems Hugo’s external helpers don’t honor bash aliases so I ended up creating a one-liner bash script with a no-op, calling it asciidoc and dropping it into my project. Then I call hugo foo with PATH adjusted as suggested here to round off the hack.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.