Heading 7+ not handled?

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

Heading 7+ not handled?

rwinch
I get into instances where I would like to use headings of 7 and possibly higher. However, when I use heading of 7 or
higher with html5 asciidoctor renders the markup. For example, the following:

======= 7.a
asdf

renders as a paragraph:

<div class="paragraph">
<p>======= 7.a
asdf</p>
</div>

I understand that html doesn't have a h7, but it would be nice if asciidoctor either:

* Handled it gracefully (i.e. making it bold and ensuring to add an anchor id next to it). I think I would prefer something
like this since we shouldn't really be aware of our backend we are writing for.
* Failed with an error message

Any thoughts on this? Is it a bug...a missing configuration setting?

Thanks!
Rob Winch

PS: Below is a full valid document is below to make testing easier:

= 1

asdf

== 2.a

asdf

=== 3.a
asdf

==== 4.a
asdf

===== 5.a
asdf

====== 6.a
asdf

======= 7.a
asdf

======= 7.b
asdf

====== 6.b
asdf

===== 5.b
asdf

==== 4.b
asdf

=== 3.b
asdf

== 2.b
asdf
Reply | Threaded
Open this post in threaded view
|

Re: Heading 7+ not handled?

mojavelinux
Administrator
Rob,

The same is true for AsciiDoc Python. In fact, Asciidoctor supports one more level than AsciiDoc (heading 6).

My advice is that once you get that deep, you are better off using a block title (i.e., label) rather than a heading. An open block is a great way to get the output you are expecting.

Here's an example of an open block used for this purpose:

```asciidoc
.[[pseudo-section]]Pseudo Section
--
This is an open block with a title and refid.

It's kind of like a lightweight section.

It may contain other blocks and paragraphs.
--
```

Here's how it's rendered:

```html
<div class="openblock"><div class="title"><a id="pseudo-section"></a>Pseudo Section</div>
<div class="content">
<div class="paragraph">
<p>This is an open block with a title.</p>
</div>
<div class="paragraph">
<p>It&#8217;s kind of like a lightweight section.</p>
</div>
<div class="paragraph">
<p>It may contain other blocks and paragraphs.</p>
</div>
</div>
</div>
```

Another approach is to use a floating (i.e., discrete) heading. This allows you to insert a plain heading that isn't seen as a section, but still has an auto-generated id. It still has the be between heading 1 and 6.

Here's an example of a discrete heading:

```asciidoc
[float]
====== Pseudo Section

This text is a sibling, not a child, of the discrete heading above. The discrete heading level does not have to follow the section level hierarchy.
```

AsciiDoc doesn't attempt to validate intents. By that, I mean that if you don't insert syntax it recognizes, it just assumes it's regular content. It would be very expensive (and quite complex) to attempt to validate all permutations of syntax that fall outside of the AsciiDoc syntax...and probably catch stuff it shouldn't.

What I do see as a possibility is to have a separate validator program in the Asciidoctor ecosystem that looks for these types of errors and beyond-the-edge cases. That's also something that a tool might address (in the same way that a Java IDE provides validation warnings). Another way to know you've gone outside the syntax is to have a good syntax highlighter. When using VIM, for instance, I know a heading 7 is invalid because the syntax shuts off after heading 6.

At the very least, I think the information and recommendations I wrote in this e-mail should go into the user manual. Could you point me to the place in the Spring docs where a heading 7 is used so that I can look at this from a reader's perspective?

Let me know what you think about these suggestions.

-Dan


On Fri, Oct 4, 2013 at 3:38 PM, rwinch [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I get into instances where I would like to use headings of 7 and possibly higher. However, when I use heading of 7 or
higher with html5 asciidoctor renders the markup. For example, the following:

======= 7.a
asdf

renders as a paragraph:

<div class="paragraph">
<p>======= 7.a
asdf</p>
</div>

I understand that html doesn't have a h7, but it would be nice if asciidoctor either:

* Handled it gracefully (i.e. making it bold and ensuring to add an anchor id next to it). I think I would prefer something
like this since we shouldn't really be aware of our backend we are writing for.
* Failed with an error message

Any thoughts on this? Is it a bug...a missing configuration setting?

Thanks!
Rob Winch

PS: Below is a full valid document is below to make testing easier:

= 1

asdf

== 2.a

asdf

=== 3.a
asdf

==== 4.a
asdf

===== 5.a
asdf

====== 6.a
asdf

======= 7.a
asdf

======= 7.b
asdf

====== 6.b
asdf

===== 5.b
asdf

==== 4.b
asdf

=== 3.b
asdf

== 2.b
asdf


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Heading-7-not-handled-tp710.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Heading 7+ not handled?

rwinch
Thanks for the response.  The more I think about it the more I think I am probably using the heading incorrectly.

The first part of my problem is that I am only using a single level 0 header due to an issue with the pdf rendering [1]. I'm not very knowledgeable on how to fix the issue myself (and a bit pressed for time), so I worked around it by increasing the headers under a parent element.

An example where I was using something like this was for attributes within our XML configuration appendix [2]. I changed this to be a bullet list in the new reference [3], but wasn't keen on needing to add the ids manually. In light of your response, I think that using a heading here was probably the wrong approach in the first place.

Another example of this happening was in the Spring Reference [4]. Again, this is translated to a header 7 due to the pdf issue.

I think your response helps with this issue. Particularly it would be good to find something in the documentation on how to deal with heading level 7.

[1] https://github.com/mojavelinux/asciidoctor-fopdf/issues/5
[2] http://docs.spring.io/spring-security/site/docs/3.2.0.RC1/reference/htmlsingle/#nsa-access-denied-handler-error-page
[3] http://docs.spring.io/spring-security/site/docs/3.2.0.CI-SNAPSHOT/reference/html5/#nsa-access-denied-handler-error-page
[4] http://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/htmlsingle/#beans-factory-ctor-arguments-name