Skip to content

AsciidoctorJ extension that postprocesses HTML documents to be more usable with the Hugo static site generator

License

Notifications You must be signed in to change notification settings

bootique-tools/hugo-asciidoctorj-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central

AsciidoctorJ Hugo Extension

AsciidoctorJ post processor, that extracts ToC into separate file and optionally can inject content into rendered document. Can be used only for HTML backend, will fail if used with PDF.

It is targeted to inject front-matter section suitable for the Hugo website generator.

Usage

Here's a simple usage example:

<build>
    <plugins>
        <plugin>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctor-maven-plugin</artifactId>
            <version>${asciidoctor.maven.plugin.version}</version>
            <dependencies>
                <dependency>
                    <groupId>io.bootique.tools</groupId>
                    <artifactId>hugo-asciidoctorj-extension</artifactId>
                    <version>${hugo.asciidoctorj.extension.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>asciidoctor-html-hugo</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>process-asciidoc</goal>
                    </goals>
                    <configuration>
                        <doctype>book</doctype>
                        <backend>html5</backend>
                        <!-- ... -->
                        <extensions>
                            <extension>
                                <className>io.bootique.tools.asciidoctorj.HugoExtension</className>
                            </extension>
                        </extensions>
                        <attributes>
                            <!-- ... -->
                        </attributes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <!-- ...   -->
</build>

Projects using this extension:

Control Attributes

Extension controlled by attributes in *.adoc file:

  • hugo-header: header file name, if not set empty 'front-matter' will be used
  • hugo-font-awesome-icons: convert icons to a FontAwesome compatible variant (true/false, default is true)
  • hugo-multipage: split document to a separate pages (true/false, default is false)
  • hugo-multipage-level: nested section level that will be used for a single page content in a multipage documents (default is 1)
  • hugo-multipage-header: header file name to add to a multipage documents, index page will always use hugo-header, if not set empty 'front-matter' will be used
  • hugo-multipage-ref: reference prefix for a multipage navigation (could be something like /docs/1.x/)

Support

You could open an issue or a feature request via GitHub Issues

Development

You need Java 8+ and Maven.

Release

mvn release:prepare -Prelease
mvn release:perform -Prelease

About

AsciidoctorJ extension that postprocesses HTML documents to be more usable with the Hugo static site generator

Resources

License

Stars

Watchers

Forks

Packages