devacfr / reflow-maven-skin

Reflow is an Apache Maven site skin built on Bootstrap. It allows various structural and stylistic customizations to create a modern-looking Maven-generated website.
http://devacfr.github.io/reflow-maven-skin/
Apache License 2.0
8 stars 3 forks source link

Do not override heading ids #63

Closed aurelien-baudet closed 4 years ago

aurelien-baudet commented 4 years ago

Current behavior

Context

I use Asciidoctor to generate documentation. Asciidoctor generates anchors and a toc using headings:

Ids generated by Asciidoctor are also important because we can make links between different documents (using <<other-document.adoc#custom-id, text>>).

Conflict

Reflow Maven Skin also generates ids for headings based on heading text. However, Reflow Maven Skin always overrides the ids present on the headings.

Therefore, links between documents and anchors generated by Asciidoctor don't work.

Expected behavior

If a heading already has an id, let the id as-is and use it directly.

I think skipping existing ids should be the default behavior. There could have configuration paramters to indicate that all ids are overriden.

The other possibility is to keep id overriding by default but provide configuration parameters to control that. For example, HtmlTool line 1074 could use a configuration parameter to exclude particular pages.

Deal with symbols

As stated in HtmlTool lin 1090, existing id may be malformed. As it is explicitly created by the developer (or a tool used by the developer), there could only have a warning in logs.

Another possibility is to add a configuration parameter to:

Additional information

asciidoctorj version: 1.5.6 asciidoctor-maven-plugin: 1.5.6 reflow-maven-skin: 2.2.0 maven-site-plugin: 3.7

devacfr commented 4 years ago

@aurelien-baudet hello, Thank you for your feedback. I'm following the your work on project ogham. And for this reason, i'll prepare a new version (2.3.0) to (try) simplify your expectation concerning the visual. Normally in your project, your user manual documentation page (i suppose) shouldn't call this method (do not contains TOC).

Now, you can integrate a free content directly (without modification) in body page (https://github.com/devacfr/reflow-maven-skin/issues/61).

< reflowSkin>
  <pages>
    <index type="body" />
  </pages>
</reflowSkin>

A snapshot version 2.3.0-SNAPSHOT is available on maven central. Be careful, This version includes also a big change on header (https://github.com/devacfr/reflow-maven-skin/issues/58) (also for you) allowing to custom the header component.

I'm waiting your feedback. Best Regards. available online on Gitter

devacfr commented 4 years ago

@aurelien-baudet, could you say me on which pages of your project you are this problem? For me, the problem is the execution of method htmlTool.ensureHeadingIds is executed even there is no toc <toc>false</toc>. And also set <html5Anchor>false</html5Anchor> globally or on specific page. see HTML5-style anchors

devacfr commented 4 years ago

@aurelien-baudet A new snapshot version 2.3.0-SNAPSHOT is available on maven central with the fix 098068c. If you want a hot fix on previous version 2.2.0. Let me know.

aurelien-baudet commented 4 years ago

Great !

I will try the snapshot version as soon as possible to give you a feedback.

aurelien-baudet commented 4 years ago

Mgration to 2.30 done with no issue !

devacfr commented 4 years ago

@aurelien-baudet. I recommend use maven-site-plugin 3.9.1, fix problem on <pre> element rendering.

aurelien-baudet commented 4 years ago

Did you mean 3.9.0 ? Because 3.9.1 doesn't seem to exist.

devacfr commented 4 years ago

@aurelien-baudet sorry, I confused with the version of Doxia-tools. Yes, the version of maven-site-plugin is 3.9.0.