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

Left-out headers not shown as zero #18

Closed
flaushi opened this issue Mar 30, 2021 · 3 comments
Closed

Left-out headers not shown as zero #18

flaushi opened this issue Mar 30, 2021 · 3 comments
Assignees
Labels
evaluation Evaluating alternative dependencies and code
Milestone

Comments

@flaushi
Copy link

flaushi commented Mar 30, 2021

Assume I have a document like

1. Heading h1
2. Heading two h1
2.1 First H2
3. Third H1
3.0.1 First H3 (H2 is missing)

Then the output of the lib is

1. Heading h1
2. Heading two h1
2.1 First H2
3. Third H1
3.1 3.1.1 First H3 (H2 is missing)

Can I fix this just with an option?
My problem I guess is the "empty" li that is created and counts. It increments the leftout layer and gives the 1 instead of 0.

My corresponding css does behave as I'd like:


.toc ol {
			list-style-type: none;
			counter-reset: item;
			margin: 0;
			padding: 0;
		}


		.toc ol > li:before  {
            counter-increment: item;
            margin: 0;
            padding: 0;
			content: counters(item, ".") ". ";

		}

.report-content {
  counter-reset: h1counter;
}

.report-content  h1  {
    counter-increment: h1counter;
    counter-reset: h2counter h3counter h4counter;
}

.report-content h1:before {
    content: counters(h1counter, ".") " ";
    margin-right: 10px;
}

.report-content  h2 {
  counter-increment: h2counter;
  counter-reset: h3counter h4counter ;
}

.report-content  h2:before {
  content: counters(h1counter, ".") "." counters(h2counter, ".") " ";
  margin-right: 10px;
}

.report-content  h3 {
  counter-increment: h3counter;
  counter-reset: h4counter;
}

.report-content  h3:before {
    content: counters(h1counter, ".") "." counters(h2counter, ".") "." counters(h3counter, ".") " ";
    margin-right: 10px;
}
@caseyamcl caseyamcl self-assigned this Apr 14, 2021
@caseyamcl caseyamcl added the bug label Apr 14, 2021
@caseyamcl caseyamcl added this to the Version 4.0 milestone Dec 8, 2024
@caseyamcl
Copy link
Owner

Hi @flaushi. I know it's been over 3.5 years since you submitted this issue, but I finally have some bandwidth to show this library some 💖.

I looked into this, and it is not possible to generate x.0.x-type items using strictly HTML (<ol>). I think your CSS solution is the only way to make it work.

Since this library doesn't manipulate CSS (only HTML), I feel like this out-of-scope, but we may be able to add some information to the documentation in case other people have this issue.

@caseyamcl caseyamcl reopened this Dec 13, 2024
@caseyamcl
Copy link
Owner

caseyamcl commented Dec 13, 2024

Maybe try manipulating the start attribute in HTML?

<ol>
  <li>Some heading</li>
  <ol start="1">
    <li>Some sub-heading</li>
    <li>Another sub-heading</li>
  </ol>
  <li>Another heading</li>
  <ol start="0">
    <li></li>
    <ol start="1">
      <li>Sub-sub-sub-heading</li>
    </ol>
  </ol>
</ol>

@caseyamcl caseyamcl added evaluation Evaluating alternative dependencies and code and removed bug labels Dec 13, 2024
@caseyamcl
Copy link
Owner

Added some information to the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluation Evaluating alternative dependencies and code
Projects
None yet
Development

No branches or pull requests

2 participants