-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9966b6b
commit 70083e6
Showing
4 changed files
with
136 additions
and
20 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
packages/demo/src/content/docs/start-here/accessibility.md
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
packages/demo/src/content/docs/start-here/accessibility.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: Accessibility | ||
--- | ||
|
||
import { Tabs, TabItem } from "@astrojs/starlight/components"; | ||
|
||
## Alt | ||
|
||
Works only with `strategy=file` and `strategy=data-url`. | ||
|
||
<Tabs> | ||
<TabItem label="Markdown"> | ||
````md | ||
```d2 strategy=file pad=20 alt="testing alt" | ||
direction: right | ||
a -> b -> c -> d -> e | ||
``` | ||
```` | ||
</TabItem> | ||
<TabItem label="Diagram"> | ||
```d2 strategy=file pad=20 alt="testing alt" | ||
direction: right | ||
a -> b -> c -> d -> e | ||
``` | ||
|
||
</TabItem> | ||
<TabItem label="Resulting HTML"> | ||
```html | ||
... | ||
<img alt="testing alt" .../> | ||
... | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
## Figcaption | ||
|
||
[figcaption](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figcaption) can be implemented. | ||
|
||
## Mermaid | ||
|
||
Mermaid has special params for accessibility | ||
|
||
<Tabs> | ||
<TabItem label="Markdown"> | ||
````md | ||
```mermaid strategy=inline | ||
graph LR | ||
accTitle: Big Decisions | ||
accDescr: Bob's Burgers process for making big decisions | ||
a --> b | ||
``` | ||
```` | ||
</TabItem> | ||
<TabItem label="HTML"> | ||
|
||
```xml | ||
<svg> | ||
<desc>Bob's Burgers process for making big decisions</desc> | ||
</svg> | ||
``` | ||
</TabItem> | ||
<TabItem label="Diagram"> | ||
```mermaid strategy=inline | ||
graph LR | ||
accTitle: Big Decisions | ||
accDescr: Bob's Burgers process for making big decisions | ||
a --> b | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
60 changes: 60 additions & 0 deletions
60
packages/demo/src/content/docs/start-here/configuration.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: Configuration | ||
sidebar: | ||
order: 4 | ||
--- | ||
|
||
All Rehype diagram plugins support (at least) following configurations: | ||
|
||
- `cache` (optional) - Map-like storage to speed up consequent renders of page. You can use standard JS `Map`, but probably it is better to use [@beoe/cache](https://github.com/stereobooster/beoe/tree/main/packages/cache/). | ||
- `class` (optional) - allows to setup additional classes for diagrams. For example, `.not-content` for inline diagrams if you use [tailwindcss-typography](https://github.com/tailwindlabs/tailwindcss-typography) | ||
- `svgo` (optional) - options for [SVGO](https://github.com/svg/svgo). Use `false` to disable optimization with SVGO | ||
- [`strategy`](/start-here/strategy/) | ||
- [`darkScheme`](/start-here/dark-scheme/) | ||
|
||
All configurations can be set either globally or locally (via fence-code meta). Global configurations applies to all diagrams. Local configurations applies only to one diagram. Local configurations always override global, with exception for `class` option (it applies all provided classes). | ||
|
||
Also you want be able to set `cache` and `svgo` via local configurations, excpet disabling them with `false` value. | ||
|
||
## Global configurations | ||
|
||
For example, | ||
|
||
```js | ||
import { getCache } from "@beoe/cache"; | ||
const cache = await getCache(); | ||
|
||
use(rehypeDiagram, { | ||
strategy: "file", | ||
darkTheme: "class", | ||
class: "not-content", | ||
cache, | ||
}); | ||
``` | ||
|
||
## Local configurations | ||
|
||
````md | ||
```some-diagram strategy=inline darkTheme=false class=interactive | ||
... | ||
``` | ||
```` | ||
|
||
## Other configurations | ||
|
||
Often plugins would have additional options, for example, D2 also has `d2Options` | ||
|
||
```js | ||
import { getCache } from "@beoe/cache"; | ||
const cache = await getCache(); | ||
|
||
use(rehypeD2, { | ||
d2Options: { pad: 20 }, | ||
}); | ||
``` | ||
|
||
````md | ||
```d2 pad=50 | ||
... | ||
``` | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters