Skip to content

Label with hierarchical numbering 1.2.2.1 #327

@flaushi

Description

@flaushi

I am using the ListRenderer to create a table of contents for a webpage (actually I use https://github.com/caseyamcl/toc and th OrderedListRenderer).

Using some CSS pseudo elements, I am able to get hierarical numbering dynamically:

<style>
		ol {
			list-style-type: none;
			counter-reset: item;
			margin: 0;
			padding: 0;
		}
		ol > li {
			display: table;
			counter-increment: item;
			margin-bottom: 0.6em;
		}
		ol > li:before {
			content: counters(item, ".") ". ";
			display: table-cell;
			padding-right: 0.6em;
		}
		li ol > li {
			margin: 0;
		}
		li ol > li:before {
			content: counters(item, ".") " ";
		}

Gives something like:
image

But would it be possible to compute and render these "addresses" and set them as value attribute in the created list? Like here https://www.w3schools.com/tags/att_li_value.asp

<li value="2.1">Übersicht</li>

Thanks in advance! Stay healty!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions