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

Generate ToC subsections from markdown sections #707

Open
idomingu opened this issue Jun 6, 2024 · 5 comments
Open

Generate ToC subsections from markdown sections #707

idomingu opened this issue Jun 6, 2024 · 5 comments

Comments

@idomingu
Copy link

idomingu commented Jun 6, 2024

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
Copy link
Owner

dgarijo commented Jun 6, 2024

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
Copy link
Author

idomingu commented Jun 6, 2024

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
Copy link
Owner

dgarijo commented Jun 6, 2024

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

@idomingu
Copy link
Author

idomingu commented Jun 6, 2024

Worked like a charm! Thanks!

@dgarijo
Copy link
Owner

dgarijo commented Jun 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants