HUGO

Asciidoctor removes <div id="content">

Update:

Doing a little more digging, I found that most of missing parts are a consequence of
the --no-header-footer parameter being passed to asciidoctor. When setting this to false, everything is kept, so it is not an issue from hugo’s side.


I am trying to figure out what hugo removes from an asciidoctor output.

  1. What is the best way to see the output from asciidoctor output prior to hugo making surgery with the output, i.e. I want to know what surgery is being performed.

  2. I noticed that class=" " definitions are removed. How do I specify that they be not removed.

  3. div id=“content” is removed, and it is removed by removing this line and making this div part of the preceeding div, this is kind of weird, as the content may have its own styles which are different from the preceeding div, i.e. they should have distinct divs.

  4. div id=“header” is also removed. Actually partially removed, because I have some remnants from the header which are retained while other things are removed. How can I retain this header?

Here is a short example:

Output from asciidoctor:

<body class="article toc2 toc-left">
<div id="header">
<h1>asciidoctor</h1>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#_mermaid">mermaid</a></li>
</ul>
</div>
</div>
<div id="content">
<div id="preamble">
... etc

.Content from hugo:

<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#_mermaid">mermaid</a></li>
</ul>
</div>
<div id="preamble">
... etc

As you can see, <h1> got removed, but <div id="toc"> also got removed.
However <div id="toctitle"> did not. And then </div><div id="content"> also got removed.

  • this behaviour is not consistent
  • is it possible to retain everything from <div id="header"> and <div id="content">

I found hugo/markup/asciidocext/convert.go, how would I run this independently from the rest of hugo, I see convert_test.go, there is function there that does take a adoc file TestAsciidoctorWorkingFolderCurrent, is running go test there sufficient to test it separately?