Skip to content

Commit

Permalink
Merge pull request #542 from awanlin/topic/refactor-mermaid
Browse files Browse the repository at this point in the history
Refactor mermaid implementation
  • Loading branch information
awanlin authored Aug 26, 2024
2 parents 6a25c70 + 2c3c46b commit 6d7edb4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip3 install mkdocs-techdocs-core mkdocs-kroki-plugin
RUN pip3 install mkdocs-techdocs-core markdown-inline-mermaid

RUN yarn global add @mermaid-js/mermaid-cli

RUN curl -o plantuml.jar -L https://github.com/plantuml/plantuml/releases/download/v1.2023.10/plantuml-1.2023.10.jar && echo "527d28af080ae91a455e7023e1a726c7714dc98e plantuml.jar" | sha1sum -c - && mv plantuml.jar /opt/plantuml.jar
RUN echo '#!/bin/sh\n\njava -jar '/opt/plantuml.jar' ${@}' >> /usr/local/bin/plantuml
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,25 @@ You can see our Renovate configuration in the [`renovate.json`](https://github.c
> Note: you may not see any Pull Request as we very much like to stay on top of them, clicking on the "Closed" option will let you see examples that have been merged in the past.
To learn how to get started with Renovate we recommend reading the [Installing and onboarding Renovate into repositories](https://docs.renovatebot.com/getting-started/installing-onboarding/) documentation.

## Working With This Repo

The following sections are to help those working with this repo to keep in maintained.

### Local Docker

The Dockerfile in this repo can be built locally using the following command:

```bash
docker image build . -t demo --build-arg ENVIRONMENT_CONFIG=local
```

This will build the image with your `app-config.local.yaml` included this allows you to include any config you might want to have in place for local testing.

Using `--progress=plain --no-cache` can also be helpful with testing changes.

You can then run it with this command:

```bash
docker run -it -p 7007:7007 demo
```
14 changes: 6 additions & 8 deletions docs/examples/mermaid.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,23 @@ To be able to use Mermaid diagrams with TechDocs you'll need to follow this guid

Here is an example:

```kroki-mermaid
```mermaid
sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
```

>Note: For this example we are using [Kroki.io](https://kroki.io/), but you may which to run your own server to protect TechDocs with sensitive content. More details on this topic are in the previously linked guide.
## Markdown

Here is the Markdown:

```markdown
kroki-mermaid
mermaid
sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
```

>Note: in order to prevent Mermaid from rendering the diagram above the backticks (\`) have been removed. You'll want to add 3 backticks on line 1 before `kroki-mermaid` and then another 3 backticks on a new line below line 5.
> Note: in order to prevent Mermaid from rendering the diagram above the backticks (\`) have been removed. You'll want to add 3 backticks on line 1 before `mermaid` and then another 3 backticks on a new line below line 5.
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ site_name: 'Backstage Demo'

plugins:
- techdocs-core
- kroki

markdown_extensions:
- markdown_inline_mermaid

0 comments on commit 6d7edb4

Please sign in to comment.