Skip to content

Commit cd026fa

Browse files
committed
chore: work on the docs, fix mermaid integration
1 parent 944f5b9 commit cd026fa

File tree

16 files changed

+1000
-14
lines changed

16 files changed

+1000
-14
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
.astro/
2+
.astro/
3+
dist/

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Many users of design tokens use theming, such as the use of light and dark mode
2727

2828
To manage these tokens amd their various combinations, users usually end up adopting complicated naming taxonomies to keep all of the tokens unique within a global namespace.
2929

30-
![Naming problems](./assets/naming.webp)
30+
![Naming problems](./docs/public/naming.webp)
3131

3232
These solutions via naming are overly brittle, and in practice most users end up separating their various dimensions like `theme`, `mode` `variant` ,etc into different sets which are intended to override each other. The is also used to circumvent issues of changing tokens when using tools that attach a token directly on a design element.
3333

@@ -47,7 +47,7 @@ Using the above parameters, the proposal is that we create standalone resolver f
4747

4848
## Background
4949

50-
This approach is based off the existing work in the [Tokens Studio Plugin](https://github.com/tokens-studio/figma-plugin) which currently supports multidimensional tokens through the use of its `$themes.json` file that it exports with the following shape
50+
This approach is based on the existing work in the [Tokens Studio Plugin](https://github.com/tokens-studio/figma-plugin) which currently supports multidimensional tokens through the use of its `$themes.json` file that it exports with the following shape
5151

5252
```json5
5353
[
@@ -101,7 +101,7 @@ _The token sets used are typically larger than what is shown and there are cases
101101

102102
There are a number of problems to this approach though. This is currently being applied to create a single addressable space for tokens and is not granular. If you wanted to create a much smaller set that represented each component for example, you could not as the output of the set resolution is a single named token set that is then used to reference the tokens.
103103

104-
![Resolver image](./assets/Button-Breakdown.png)
104+
![Resolver image](./docs/public/Button-Breakdown.png)
105105

106106
_The references to the tokens used in this styling are tied to a single addressable token space_
107107

@@ -191,7 +191,7 @@ Please see the [json schema](./schema.json) for this for a more rigid definition
191191

192192
For visual thinkers the following is in effect
193193

194-
![Resolver image](./assets/resolvers.png)
194+
![Resolver image](./docs/public/resolvers.png)
195195

196196
For the type property there are multiple possible values
197197

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { ExpressiveCodePlugin } from '@expressive-code/core';
2+
3+
export function pluginLanguageClass(): ExpressiveCodePlugin {
4+
return {
5+
name: 'PluginLanguageClass',
6+
hooks: {
7+
postprocessRenderedBlock: (opts) => {
8+
if (opts.codeBlock.language === 'mermaid') {
9+
const pre = opts.renderData.blockAst.children.find(
10+
(child) => child.type === 'element' && child.tagName === 'pre',
11+
);
12+
if (pre && pre.type === 'element') {
13+
// add the mermaid language class so mermaid can pick this up
14+
pre.properties = {
15+
class: `${opts.codeBlock.language} hidden`,
16+
};
17+
18+
// replace the AST that expressive code has made and put back the simple text
19+
// otherwise mermaid gets confused by all of the generated HTML syntax
20+
pre.children = [
21+
{
22+
value: opts.codeBlock.code,
23+
type: 'text',
24+
},
25+
];
26+
}
27+
}
28+
},
29+
},
30+
};
31+
}

docs/public/Button-Breakdown.png

36.7 KB
Loading

docs/public/naming.webp

42.3 KB
Binary file not shown.

docs/public/resolvers.png

36.4 KB
Loading

docs/src/components/Head.astro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
import Default from '@astrojs/starlight/components/Head.astro';
3+
import type { Props } from '@astrojs/starlight/props';
4+
---
5+
<Default {...Astro.props}>
6+
<slot />
7+
</Default>
8+
<script src="../setup"></script>

0 commit comments

Comments
 (0)