dgarijo / Widoco

Wizard for documenting ontologies. WIDOCO is a step by step generator of HTML templates with the documentation of your ontology. It uses the LODE environment to create part of the template.
Apache License 2.0
295 stars 89 forks source link

Generate ToC subsections from markdown sections #707

Open idomingu opened 5 months ago

idomingu commented 5 months ago

Would be nice to generate new subsections from the sections specified in markdown text. These new subsections would be included in the Table of Contents at the beginning.

For example, in the following:

<https://example.org> rdf:type owl:Ontology ;
                      dcterms:description """

Here starts the Description section (should appear as section 3 in the ToC).

### Examples

Here starts the Examples subsection (should appear as section 3.1 in the ToC).
"""@en.

I have tested this issuing the following command java -jar widoco.jar -ontFile ontology/ontology.ttl -outFolder $dir -webVowl -uniteSections -oops -rewriteAll -getOntologyMetadata. The Examples subsection is rendered in the final HTML (without numbering), though the ToC is not updated.

Widoco release 1.4.24.

Thanks!

dgarijo commented 5 months ago

In theory it should work. have you tried to add the headers in html? (e.g., <h2> Examples </h2>).

The only thing I can think of is that the rendering library in markdown takes more time than the script used to create the table.

idomingu commented 5 months ago

I'm afraid it did not work. I got the same result as if using markdown headers (i.e., ### results into <h3>).

Another thing I noticed is that < > characters must be escaped in the markdown text. Otherwise, they are considered as HTML labels and end up removed. In the previous example I had to do the following:

&lt;https://example.org&gt; rdf:type owl:Ontology ;
                      dcterms:description """

Here starts the Description section (should appear as section 3 in the ToC).

&lt;h3&gt; Examples &lt;/h3&gt;

Here starts the Examples subsection (should appear as section 3.1 in the ToC).
"""@en.

Thanks!

dgarijo commented 5 months ago

Try <h3 id="examples" class="list">

idomingu commented 5 months ago

Worked like a charm! Thanks!

dgarijo commented 5 months ago

I will leave the issue open until this is documented. The reason why the markdown does not work is that it does not know the class. Not sure if there is an easy fix. Alternatively I can document it and provide the solution above