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

Unknown style for listing block: mermaid #1272

Closed
amusarra opened this issue Apr 21, 2024 · 6 comments
Closed

Unknown style for listing block: mermaid #1272

amusarra opened this issue Apr 21, 2024 · 6 comments
Labels

Comments

@amusarra
Copy link

Hi.
Following your examples, I created a Maven project to generate a PDF document from an asciidoc source. The source document contains Mermaid digraphs. When I run the process-asciidoc goal, I get the error in question.

...
[ERROR] asciidoctor: DEBUG: source-doc.adoc: line 130: unknown style for listing block: mermaid
[ERROR] asciidoctor: DEBUG: source-doc.adoc: line 213: unknown style for open block: mermaid
...

Followed by a Mermaid block which causes problems even though it shouldn't since it is syntactically correct and the IntellijIDEA plugin displays it correctly.

[mermaid]
----
sequenceDiagram
	autonumber
	Producer ->> Producer: Generate Message/Event
	Producer -->> Event Bus: Publish Message/Event (async)
	Event Bus -->> Consumer: Forward Message/Event (async)
	Consumer ->> Consumer: Process Message/Event

 Note over Producer,Consumer: A typical interaction
----
image

Below is the pom.xml file used.

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>it.dontesta.eventbus.docs</groupId>
    <artifactId>eventbus-logging-filter-jaxrs-docs</artifactId>
    <version>1.0.7-RC1</version>

    <name>eventbus-logging-filter-jaxrs-docs</name>
    <url>http://www.example.com</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <asciidoctor.maven.plugin.version>3.0.0</asciidoctor.maven.plugin.version>
        <asciidoctorj.pdf.version>2.3.15</asciidoctorj.pdf.version>
        <asciidoctorj.version>2.5.12</asciidoctorj.version>
        <asciidoctorj.diagram.version>2.3.0</asciidoctorj.diagram.version>
        <asciidoctorj.diagram-plantuml.version>1.2024.3</asciidoctorj.diagram-plantuml.version>
        <asciidoctorj.diagram-ditaamini.version>1.0.3</asciidoctorj.diagram-ditaamini.version>
        <jruby.version>9.4.6.0</jruby.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>process-resources</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-pdf</artifactId>
                        <version>${asciidoctorj.pdf.version}</version>
                    </dependency>
                    <!-- Comment this section to use the default jruby artifact provided by the plugin -->
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby</artifactId>
                        <version>${jruby.version}</version>
                    </dependency>
                    <!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-diagram</artifactId>
                        <version>${asciidoctorj.diagram.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-diagram-plantuml</artifactId>
                        <version>${asciidoctorj.diagram-plantuml.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-diagram-ditaamini</artifactId>
                        <version>${asciidoctorj.diagram-ditaamini.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDirectory>src/main/docs/asciidoc</sourceDirectory>
                    <enableVerbose>true</enableVerbose>
                    <logHandler>
                        <outputToConsole>true</outputToConsole>
                        <failIf>
                            <severity>DEBUG</severity>
                        </failIf>
                    </logHandler>
                    <!-- Attributes common to all output formats -->
                    <attributes>
                        <attribute-missing>warn</attribute-missing>
                        <allow-uri-read>true</allow-uri-read>
                        <source-highlighter>rouge</source-highlighter>
                        <imagesdir>../resources/images</imagesdir>
                        <themesdir>../resources/themes</themesdir>
                        <revnumber>${project.version}</revnumber>
                        <revdate>${maven.build.timestamp}</revdate>
                        <revremark>Digital Version</revremark>
                        <organization>${project.organization.name}</organization>
                    </attributes>
                </configuration>
                <executions>
                    <execution>
                        <id>generate-pdf-doc</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>pdf</backend>
                            <attributes>
                                <source-highlighter>rouge</source-highlighter>
                                <pdf-theme>basic</pdf-theme>
                                <pdf-themesdir>../resources/themes</pdf-themesdir>
                                <icons>font</icons>
                                <pagenums/>
                                <toc/>
                                <idprefix/>
                                <idseparator>-</idseparator>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

The mmdc is installed by the command npm install -g @mermaid-js/mermaid-cli and available on $PATH. The version of the
mmdc -> 10.8.0.

What's the problem?

@robertpanzer
Copy link
Member

Please add a requires element for asciidoctor-diagram.

@abelsromero
Copy link
Member

abelsromero commented Apr 21, 2024

Yes, you can see how to do it in https://github.com/asciidoctor/asciidoctor-maven-examples/blob/20ba3920b2257afbf2c783b10d728626a421d3ee/asciidoctor-diagram-example/pom.xml#L60-L62. I tested and is working fine in my machine.

PS: @robertpanzer beat me to answer by seconds 😅

@amusarra
Copy link
Author

Hi @robertpanzer and @abelsromero
Thank you very much for the suggestion.

Why is this very important configuration not documented in the project's README and the rest of the documentation?

I assumed that by placing the dependency on the maven plugin configuration there was no need for anything else, usually Maven plugins work this way.

Could you update the configuration by indicating this important configuration item? What you suggested is not even indicated here https://docs.asciidoctor.org/maven-tools/latest/plugin/introduction/

Thanks again.

@mojavelinux
Copy link
Member

You are welcome to contribute to the documentation if you feel that it needs updating. This is an open source project that depends on contributions from the community. No one is responsible or obliged to make the software or documentation meet anyone else's needs.

@abelsromero
Copy link
Member

Why is this very important configuration not documented in the project's README and the rest of the documentation?

I assumed that by placing the dependency on the maven plugin configuration there was no need for anything else, usually Maven plugins work this way.

I can see the confusion tbh. On one side asciidoctorJ-diagram bundles the Ruby Gem (the actual implementation) without any extra discovery logic, and on the other requires could be better explained in https://docs.asciidoctor.org/maven-tools/latest/plugin/goals/process-asciidoc/#configuration-requires, it says "Ruby libraries" and we are adding a JAR.

But, asciidoctor-diagram configuration is very specific, is not an embedded component of the plugin, so I don't see reason to mention it in the introduction or README which contains the simplest "getting started" scenarios. For specifics, we have the examples repo which you saw and also link in the docs https://docs.asciidoctor.org/maven-tools/latest/plugin/examples/. And I am sorry to point it, but the diagram's example contains the require configuration. Maybe we could add more info the respective readme in the example, or place a comment above the XML stating it's important. But there's not much we can do about assumptions.

Btw, I'd suggest we continue the conversation in the plugin repo , this story is solved to me and is unrelated to AsciidoctorJ. Different volunteers maintain each project and there's no point on creating notifications here.

@amusarra
Copy link
Author

Thanks so much. 👍

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

No branches or pull requests

4 participants