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

Add AsciiDoc build infrastructure #862

Merged
merged 1 commit into from
Aug 23, 2024
Merged

Conversation

jld01
Copy link
Contributor

@jld01 jld01 commented Jul 11, 2024

Resolves #873

@@ -0,0 +1,8 @@
ifdef::env-github[]
:imagesdir: https://raw.githubusercontent.com/eclipse-cdt/cdt/main/doc/org.eclipse.cdt.doc.user/images
Copy link
Contributor Author

@jld01 jld01 Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a github-specific directive to locate images in the specified location for the purpose of rendering documents in github itself. Note that new images added by a PR won't yet exist at the required location.

Example of github rendering: https://github.com/jld01/cdt/blob/adoc-example/doc/org.eclipse.cdt.doc.user/src/asciidoc/example.adoc

<outputDirectory>${project.basedir}/html</outputDirectory>
<attributes>
<icons>font</icons>
<imagesdir>../images</imagesdir>
Copy link
Contributor Author

@jld01 jld01 Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The asciidoctor-maven-plugin is configured to emit HTML to the html folder of the project and look for images at ../images relative to the html folder. We can observe the plugin in operation at: https://github.com/eclipse-cdt/cdt/actions/runs/9892171366/job/27324211365#step:7:10840

// :imagesdir: {asciidoctorconfigdir}/images
//
// For more information please take a look at https://github.com/de-jcup/eclipse-asciidoctor-editor/wiki/Asciidoctor-configfiles
:imagesdir: {asciidoctorconfigdir}/images
Copy link
Contributor Author

@jld01 jld01 Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We instruct the Asciidoctor Editor to look for images in the images folder of the project. Example:

image

@jld01
Copy link
Contributor Author

jld01 commented Jul 11, 2024

@jonahgraham, @Torbjorn-Svensson, @jjohnstn and all, following our discussion on the CDT project call this week, this PR is intended to illustrate how we could integrate AsciiDoc content within the existing CDT user documentation plugin for the purpose of adding missing topics and gradually migrating existing topics over time. Comments are welcome.

If we are all happy with this approach, we could start by adding topics relating to core build.

@jonahgraham
Copy link
Member

This looks great - thanks @jld01

An early target for docs would be the current contents of https://github.com/eclipse-cdt/cdt-lsp/blob/master/README.md - although maybe that should be kept in a (new) org.eclipse.cdt.lsp.docs bundle?

cc: @ghentschke

ifdef::env-github[]
:imagesdir: https://raw.githubusercontent.com/eclipse-cdt/cdt/main/doc/org.eclipse.cdt.doc.user/images
:toc:
:toc-placement!:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need these github-specific directives to support presentation of a table of contents in github.

<linkcss />
<source-highlighter>coderay</source-highlighter>
<stylesdir>..</stylesdir>
<stylesheet>help.css</stylesheet>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the existing CDT help stylesheet

@jld01 jld01 force-pushed the adoc-example branch 6 times, most recently from 3d799c2 to 4ce20c6 Compare July 19, 2024 08:01
@jld01
Copy link
Contributor Author

jld01 commented Jul 19, 2024

@jonahgraham this is all working well now. A few additions to our common stylesheet are required to support Asciidoctor-generated HTML tables and code blocks. Are you OK with the MIT license on the definitions brought in from the default Asciidoctor stylesheet?

@jld01 jld01 changed the title Example AsciiDoc content Add AsciiDoc build infrastructure Jul 26, 2024
@jld01 jld01 requested a review from jonahgraham July 26, 2024 13:41
@jld01 jld01 added this to the 12.0.0 M1 milestone Jul 26, 2024
@jld01
Copy link
Contributor Author

jld01 commented Jul 26, 2024

@jonahgraham I have marked this as ready for review now. I have left the example.adoc file in the PR since this will allow us to confirm correct operation by inspecting the generated JAR and can serve as a template for new documentation. The resulting example.html file will not be visible in the Eclipse Help table of contents.

@jld01 jld01 marked this pull request as ready for review July 26, 2024 16:12
@jld01
Copy link
Contributor Author

jld01 commented Aug 23, 2024

I have received confirmation from @jonahgraham that the MIT-licensed CSS definitions are OK.

@jld01 jld01 merged commit e8605fd into eclipse-cdt:main Aug 23, 2024
4 checks passed
@jld01
Copy link
Contributor Author

jld01 commented Aug 26, 2024

Everything is now in place to create CDT user documentation in AsciiDoc format and build it with Maven. The build system will generate an HTML file under org.eclipse.cdt.doc.user/html/ for each *.adoc file placed in the org.eclipse.cdt.doc.user/src/asciidoc folder.

All AsciiDoc files should include the GitHub rendering support, as illustrated in the example.adoc file.

During development, the HTML files may be generated locally using:
mvn --projects org.eclipse.cdt:org.eclipse.cdt.doc.user generate-resources

@jld01 jld01 deleted the adoc-example branch August 26, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support building of user documentation from AsciiDoc
2 participants