Skip to content

Commit

Permalink
Mermaid diagrams support fixes asciidoctor#109
Browse files Browse the repository at this point in the history
  • Loading branch information
juracy committed Nov 1, 2019
1 parent 242f6fc commit 0d194b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ ARG asciidoctor_diagram_version=1.5.19
ARG asciidoctor_epub3_version=1.5.0.alpha.9
ARG asciidoctor_mathematical_version=0.3.1
ARG asciidoctor_revealjs_version=2.0.0
ARG mermaid_cli_version=0.5.1

ENV ASCIIDOCTOR_VERSION=${asciidoctor_version} \
ASCIIDOCTOR_CONFLUENCE_VERSION=${asciidoctor_confluence_version} \
ASCIIDOCTOR_PDF_VERSION=${asciidoctor_pdf_version} \
ASCIIDOCTOR_DIAGRAM_VERSION=${asciidoctor_diagram_version} \
ASCIIDOCTOR_EPUB3_VERSION=${asciidoctor_epub3_version} \
ASCIIDOCTOR_MATHEMATICAL_VERSION=${asciidoctor_mathematical_version} \
ASCIIDOCTOR_REVEALJS_VERSION=${asciidoctor_revealjs_version}
ASCIIDOCTOR_REVEALJS_VERSION=${asciidoctor_revealjs_version} \
MERMAID_CLI_VERSION=${mermaid_cli_version}

# Installing package required for the runtime of
# any of the asciidoctor-* functionnalities
Expand Down Expand Up @@ -80,6 +82,23 @@ RUN apk add --no-cache --virtual .pythonmakedepends \
seqdiag \
&& apk del -r --no-cache .pythonmakedepends

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
COPY puppeteer.json /etc

# Installing NodeJS dependencies for additional
# functionnalities as diagrams and chromium headless
RUN apk add --no-cache \
chromium \
freetype \
freetype-dev \
harfbuzz \
nodejs \
nss \
ttf-freefont \
yarn \
&& yarn global add [email protected] \
&& echo "alias mmdc='mmdc -p /etc/puppeteer.json'" > /etc/profile.d/mmdc

WORKDIR /documents
VOLUME /documents

Expand Down
4 changes: 4 additions & 0 deletions puppeteer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": ["--no-sandbox"],
"executablePath": "/usr/bin/chromium-browser"
}
5 changes: 5 additions & 0 deletions tests/test_suite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,8 @@ teardown() {
asciidoctor-pdf -D /documents/tmp \
/documents/fixtures/samples-syntax-highlight/*.adoc
}

@test "mermaid cli is installed and in version ${MERMAID_CLI_VERSION}" {
docker run -t --rm "${DOCKER_IMAGE_NAME_TO_TEST}" mmdc --version \
| grep "${MERMAID_CLI_VERSION}"
}

0 comments on commit 0d194b0

Please sign in to comment.