Skip to content

Commit

Permalink
incomplete tag for snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Feb 2, 2024
1 parent e7ca55f commit ab55d6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/tour/grid-diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dominant direction is the order in which cells are filled.

For example:

```d2
```d2-incomplete
grid-rows: 4
grid-columns: 2
# bunch of shapes
Expand All @@ -90,7 +90,7 @@ Since `grid-rows` is defined first, objects will fill rows before moving onto co

But if it were reversed:

```d2
```d2-incomplete
grid-columns: 2
grid-rows: 4
# bunch of shapes
Expand Down
6 changes: 5 additions & 1 deletion src/theme/CodeBlock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ export default function D2CodeBlock(props) {
return null;
}

let lang = props.className;
if (props.className.endsWith("-incomplete")) {
lang = "d2";
}
let scope = "plaintext";
if (props.className) {
scope = `source.${props.className.replace(/^language-/, "")}`;
scope = `source.${lang.replace(/^language-/, "")}`;
}

let [tmGrammar, setTMGrammar] = React.useState(getTextMateGrammar(scope));
Expand Down

0 comments on commit ab55d6a

Please sign in to comment.