Why no H1 with use of --no-header-footer ? (gives issues with Hugo).

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
W.
Reply | Threaded
Open this post in threaded view
|

Why no H1 with use of --no-header-footer ? (gives issues with Hugo).

W.
This post was updated on .
Context: trying to use Asciidoctor with Hugo (static site generator).

Hi,

Default Hugo uses the blackfriday MD processor.
When I use an test.md

# H1ADOC

Hello world.

## H2ADOC

Asciidoctor and Hugo would be a great team.

* one
* two

## H2ADOC

Bye.

Converting it to html with blackfriday produces the expected

<h1>H1ADOC</h1>

<p>Hello world.</p>

<h2>H2ADOC</h2>

<p>Asciidoctor and Hugo would be a great team.</p>

<ul>
<li>one</li>
<li>two</li>
</ul>

<h2>H2ADOC</h2>

<p>Bye.</p>

When I use a similar Asciidoctor test.adoc document

= H1ADOC

Hello world.

== H2ADOC

Asciidoctor and Hugo would be a great team.

* one
* two

== H2ADOC

Bye.

And convert it to html with

asciidoctor -a stylesheet=null.css -d article --no-header-footer test.adoc

(note: the null.css is just a hack to avoid all style inclusion in the result)

it produces the following html code

<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Hello world.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_h2adoc">H2ADOC</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Asciidoctor and Hugo would be a great team.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>one</p>
</li>
<li>
<p>two</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_h2adoc_2">H2ADOC</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Bye.</p>
</div>
</div>
</div>

Note that there is is no H1 and my text is gone.

Perhaps there is a reason for this behavior but it was very unexpected for me and it took some hacking to realize that this is creating issues in Hugo rendering compared to using .md.  I really like Asciidoctor, but would expect this simple test.adoc with --no-header-footer option to give similar results like the markdown processing.  Which has nothing to do with Hugo of course.

Personally, given the fact that my text "H1ADOC" is nowhere to be found in the resulting html, I would think this is bug? I thought it would be perfectly acceptable to use H1 in a .adoc file?
With and without the option of --no-header-footer.
 
Or is this on purpose?
All comment, solution or workaround is welcome.
Reply | Threaded
Open this post in threaded view
|

Re: Why no H1 with use of --no-header-footer ? (gives issues with Hugo).

mojavelinux
Administrator
When converting to embeddable HTML (--no-header-footer), you need to set the special attribute "showtitle" in order to have the H1 for the doctitle displayed.

The reasons for this switch are historical.


Cheers,

-Dan

On Fri, Jul 28, 2017 at 5:16 AM, W. [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Context: trying to use Asciidoctor with Hugo (static site generator).

Hi,

Default Hugo uses the blackfriday MD processor.
When I use an test.md

# H1ADOC

Hello world.

## H2ADOC

Asciidoctor and Hugo would be a great team.

* one
* two

## H2ADOC

Bye.

it produces the expected

<h1>H1ADOC</h1>

<p>Hello world.</p>

<h2>H2ADOC</h2>

<p>Asciidoctor and Hugo would be a great team.</p>

<ul>
<li>one</li>
<li>two</li>
</ul>

<h2>H2ADOC</h2>

<p>Bye.</p>

When I use a similar Asciidoctor test.adoc

= H1ADOC

Hello world.

== H2ADOC

Asciidoctor and Hugo would be a great team.

* one
* two

== H2ADOC

Bye.

it produces

<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Hello world.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_h2adoc">H2ADOC</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Asciidoctor and Hugo would be a great team.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>one</p>
</li>
<li>
<p>two</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_h2adoc_2">H2ADOC</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Bye.</p>
</div>
</div>
</div>

and there is no H1 and my text is gone.

Perhaps there is a reason for this behavior but it was very unexpected for me and it took some hacking to realize that this is creating issues in Hugo rendering compared to using .md.  I really like Asciidoctor, but would expect this simple test.adoc with --no-header-footer option to give similar results like the markdown processing.  Which has nothing to do with Hugo of course.

Personally, given the fact that my text "H1ADOC" is nowhere to be found in the resulting html, I would think this is bug? I thought it would be perfectly acceptable to use H1 in a .adoc file?
With and without the option of --no-header-footer.
 
Or is this on purpose?
All comment, solution or workaround is welcome.



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Why-no-H1-with-use-of-no-header-footer-gives-issues-with-Hugo-tp5762.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
W.
Reply | Threaded
Open this post in threaded view
|

Re: Why no H1 with use of --no-header-footer ? (gives issues with Hugo).

W.

That's one switch I did overlook.

Many thanks for the fast response and support on Asciidoctor !

Regards,
Wim