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 instructions for embedding diagrams from draw.io #2025

Merged
merged 6 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ sidebar.
* Use the `title` to describe the content of the video.
* Use of `srcdoc` is also required instead of plain `src` to avoid cookies if consent has not been granted.

## How to embed a diagram from _draw.io_?

Diagrams from [draw.io](https://draw.io) can be embedded as iframes by selecting _File -> Embed -> IFrame..._. As with [videos](#how-to-embed-an-external-video), the iframe `src` attribute needs to be renamed to `srcdoc`, but no further changes are necessary. An example can be found in the [Markdown source of the Reference card](docs/ref.md#drawio).

## How to add links?

Links are added using the markdown syntax `[This is my link text](link url or path)`. Whether to use a URL or path depends on if your link is *internal*, i.e. it points to another page within Docs CSC, or *external*. For internal links use relative paths, for example:
Expand Down
50 changes: 49 additions & 1 deletion docs/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,23 @@ If you don't need sound (or controls), you can use animations as an alternative
used just like [static images](#images). Both _.gif_ and _.png_ files work.


## Mermaid
## Diagrams

### Mermaid

Documented here: <https://mermaid.js.org/intro/>, but for example a fenced block like this:

````markdown
```mermaid
%%{init: {'theme': 'neutral' }}%%
graph TD
A(Does your reference card have a Mermaid chart?) -->|Yes| B(Good)
A -->|No| C(Yes, it does.)
C --> |What? No, you can't just... Oh.| B
```
````

produces a flowchart like that:

```mermaid
%%{init: {'theme': 'neutral' }}%%
Expand All @@ -427,6 +443,38 @@ graph TD
```


### Draw.io

Diagrams (including a toolbar) from [draw.io](https://draw.io) can be embedded as iframes by selecting _File ->
Embed -> IFrame..._. With line breaks added for illustration, the resulting piece of HTML could
look something like this:

```html
<iframe
frameborder="0"
style="width: 100%;
height: 301px;"
src="https://viewer.diagrams.net/?tags=blahblahblahblah%blah
blahblahblah%blahblah%blah%blahblahblahblah%blahblah"
></iframe>
```

**The `src` attribute needs to be renamed to `srcdoc`:**

```html
<iframe
...
srcdoc="..."
...
></iframe>
```

The size can be controlled by changing the value of the _style_ attribute. Note the units: _%_ for
width and _px_ for height. Here's an example with a width of 100 percent and a height of 500 pixels:

<iframe frameborder="0" style="width:100%;height:500px;" srcdoc="https://viewer.diagrams.net/?tags=%7B%7D&lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1#R%3Cmxfile%3E%3Cdiagram%20name%3D%22Page-1%22%20id%3D%22ftzXAFIqJNWyvfU7Nhta%22%3E7Zpbc9o4FMc%2FDY%2FxGN9wHgMk6UN2lllmJ7tPHWELW8W2WFmOIZ9%2BJUsy8gUwKWnSaZtkgo4uls7%2Fp%2BMjpSN7lu4eCdjGf%2BAQJiPLDHcjez6yrLFp2uwXt%2ByF5dZxhCEiKJSNDoYleoWqp7QWKIR5oyHFOKFo2zQGOMtgQBs2QAgum83WOGk%2BdQsi2DEsA5B0rc8opLGw%2Bq55sH%2BBKIrVk9mKRU0KVGNpyGMQ4lIz2fcje0YwpuJTupvBhDtP%2BUX0ezhSW0%2BMwIz2dPg7h%2BTP1TfuE8tMwIrpUjUS3RKUbUQ5ppS78o53tB5CHORGkAfGGrFSgNNtQVEW8RqUb6o2doxTeBMiwobGZC%2FGU7Pal%2BvNX8%2Fea%2Fa4%2BM83X2dP4fL5ZuzWy62XkdO9cjHBRRZCPsB4ZE%2FLGFG43IKA15YMKmaLaZrI6hS%2FgFXVk5cIzNGrXsYUUK3MaIR6GYZILyY42FQPNllBEqRVdz0snf4CCYU7zSTX9giZayj3ialqbam%2BxN9R5VKDSZpijaOafyD5jeqhDxKzD9KfqqiJfhKCRRFTxGcBV1y8jEKy5h4%2FyUZZl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