Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed May 3, 2024
1 parent f094f98 commit 9164c0d
Show file tree
Hide file tree
Showing 6 changed files with 858 additions and 112 deletions.
2 changes: 0 additions & 2 deletions packages/demo/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import expressiveCode from "./expressiveCode.mjs";

import { getCache } from "@beoe/cache";
import { rehypeGraphviz } from "@beoe/astro-graphviz/rehype";
Expand All @@ -13,7 +12,6 @@ const className = undefined; // "not-content"
// https://astro.build/config
export default defineConfig({
integrations: [
expressiveCode,
starlight({
title: "BEOE",
social: {
Expand Down
39 changes: 0 additions & 39 deletions packages/demo/expressiveCode.mjs

This file was deleted.

7 changes: 3 additions & 4 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
},
"dependencies": {
"@astrojs/check": "^0.5.10",
"@astrojs/starlight": "^0.22.0",
"@astrojs/starlight": "^0.22.1",
"@beoe/astro-graphviz": "workspace:*",
"@beoe/cache": "workspace:*",
"@beoe/rehype-gnuplot": "workspace:*",
"@beoe/rehype-mermaid": "workspace:*",
"astro": "^4.3.5",
"astro-expressive-code": "^0.35.2",
"sharp": "^0.32.5",
"astro": "^4.7.1",
"sharp": "^0.33.3",
"svg-pan-zoom-gesture": "^0.0.2",
"typescript": "^5.4.5"
}
Expand Down
12 changes: 1 addition & 11 deletions packages/rehype-code-hook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,11 @@ export default defineConfig({

### Starlight

If you want to use rehype plugin for `code` elements in Starlight you need to **either** disable built-in highlighter (`expressiveCode` and `syntaxHighlight`):
**Important** use v0.22+

```js
export default defineConfig({
integrations: [
starlight({
expressiveCode: false,
}),
],
markdown: {
syntaxHighlight: false,
rehypePlugins: [
// you rehype plugin goes here
// after you can insert code highlighter
Expand All @@ -151,10 +145,6 @@ export default defineConfig({
});
```

**or** do other workarounds see [this comment](https://github.com/withastro/starlight/discussions/1259#discussioncomment-8515492).

**or** you can use remark plugin [@beoe/remark-code-hook](/packages/rehype-code-hook/) (not implemented yet)

### Images instead of inline SVG

My main use-case is to inline SVGs, but if you want to produce images instead you can use [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs). Something like this:
Expand Down
3 changes: 3 additions & 0 deletions packages/rehype-mermaid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ It support caching the same way as [@beoe/rehype-code-hook](/packages/rehype-cod

## TODO

- BUG: with current implementation it would produce all diagrams with the same id `(mermaid-0)`, which results in styles clash
- can use `unique` prefix to resolve it
- maybe extract CSS and produce two variants to support dark mode and light mode
- maybe use `waitFor`
- maybe remove `style="max-width: ..."`
- test `mermaid-isomorphic` options (`css, mermaidConfig, prefix, browser, launchOptions`)
Expand Down
Loading

0 comments on commit 9164c0d

Please sign in to comment.