Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect section rendering when doc contains frontmatter #1041

Closed
xcoulon opened this issue Jun 12, 2022 · 0 comments · Fixed by #1042
Closed

Incorrect section rendering when doc contains frontmatter #1041

xcoulon opened this issue Jun 12, 2022 · 0 comments · Fixed by #1042

Comments

@xcoulon
Copy link
Member

xcoulon commented Jun 12, 2022

When a document begins with a front-matter portion, the title is rendered even in safe mode (using -s flag from CLI) and the section numbering is malformed (all numbers are prefixed with .).

For exemple:

---
draft: false
---

= User Manual

:sectnums!:

== Disclaimer

== Acknowledgments

:sectnums:

== Getting Started

=== Introduction

renders as

<div class="sect0">
<h1 id="_user_manual">User Manual</h1>
<div class="sect1">
<h2 id="_disclaimer">Disclaimer</h2>
<div class="sectionbody">
</div>
</div>
<div class="sect1">
<h2 id="_acknowledgments">Acknowledgments</h2>
<div class="sectionbody">
</div>
</div>
<div class="sect1">
<h2 id="_getting_started">.1. Getting Started</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_introduction">.1.1. Introduction</h3>
</div>
</div>
</div>
</div>

instead of

<div class="sect1">
<h2 id="_disclaimer">Disclaimer</h2>
<div class="sectionbody">
</div>
</div>
<div class="sect1">
<h2 id="_acknowledgments">Acknowledgments</h2>
<div class="sectionbody">
</div>
</div>
<div class="sect1">
<h2 id="_getting_started">1. Getting Started</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_introduction">1.1. Introduction</h3>
</div>
</div>
</div>
@xcoulon xcoulon added this to the v0.8.0 milestone Jun 12, 2022
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue Jun 12, 2022
Only disable the 'DocumentHeader' rule if the element is not a FrontMatter (or a blankline)

Fixes bytesparadise#1041

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
xcoulon added a commit that referenced this issue Jun 12, 2022
Only disable the `DocumentHeader` rule if the element is not a `FrontMatter` or a `BlankLine` (in case it's between the `FrontMatter` and the `DocumentHeader`)

Fixes #1041

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant