Syntax highlighting in asciidoc?

I’m genuinely grateful that you’ve added support for asciidoc. Based on my reading of the docs and these topics, it seems like Hugo does not support asciidoc syntax highlighting for code blocks, like the example shown below.
Is that true?

[source,yaml]
----
apiVersion: v1
data:
  .dockerconfigjson: xxxxx
kind: Secret
metadata:
  annotations:
    build.shipwright.io/referenced.secret: "true"
  name: secret-docker
type: kubernetes.io/dockerconfigjson
----

Is there a better workaround than using non-asciidoc-native {{highlight}} shortcode, shown here?

{{< highlight yaml >}}
apiVersion: v1
data:
  .dockerconfigjson: xxxxx
kind: Secret
metadata:
  annotations:
    build.shipwright.io/referenced.secret: "true"
  name: secret-docker
type: kubernetes.io/dockerconfigjson
{{< /highlight >}}

Currently, I’m installing the asciidoctor-rouge extension that the External Helper Asciidoctor topic mentions, and adding the following lines to my config.toml file:

  [markup.asciidocExt]
    extensions = [asciidoctor-rouge]

I’ll let you know how it goes.

You need to generate the required css from rouge and include it in your website somehow (your hugo theme might have a custom_head partial or custom css parameter).

NOTE: Asciidoctor-rouge is deprecated. Rouge support is included in asciidoctor itself. Hugo’s docs should be updated. You can specify which highlighter to use using markup.asciidocExt.attributes.source-highlighter, or by setting that attribute within the document itself.

1 Like

https://github.com/gohugoio/hugoDocs/issues/new

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