Skip to content
Draft
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
6 changes: 1 addition & 5 deletions docs-app/app/templates/3-ui/avatar.gjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
An image element with a fallback for representing the user.


<div class="featured-demo">

```gjs live preview no-shadow
```gjs repl
import { Avatar } from 'ember-primitives';

<template>
Expand Down Expand Up @@ -61,8 +59,6 @@ import { Avatar } from 'ember-primitives';
</template>
```

</div>

## Install

```hbs live
Expand Down
29 changes: 29 additions & 0 deletions docs-app/vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import { defineConfig } from "vite";
import { scopedCSS } from "ember-scoped-css/vite";
import rehypeShiki from "@shikijs/rehype";
import { visit } from "unist-util-visit";

function flatReplaceAt(array, index, replacement) {
array.splice(index, 1, ...replacement);
}

export default defineConfig(async (/* { mode } */) => {
return {
Expand All @@ -22,6 +27,29 @@
ember(),
kolay({
packages: ["ember-primitives", "which-heading-do-i-need"],
remarkPlugins: [
[
function codeToRepl(/* options */) {
return (tree) => {
return visit(tree, ["code"], function (node, index, parent) {
if (node.meta?.includes("repl")) {
let { value, lang, meta } = node;

Check failure on line 36 in docs-app/vite.config.mjs

View workflow job for this annotation

GitHub Actions / Lint

'meta' is assigned a value but never used

let newNode = {
value: `<REPL @code="${JSON.stringify(value)}" @format="${lang}" />`,
data: {},
type: "glimmer_raw",
children: [],
};
flatReplaceAt(parent.children, index, [newNode]);
return;
}
});
};
},
{},
],
],
rehypePlugins: [
[
rehypeShiki,
Expand All @@ -45,6 +73,7 @@
import { InViewport } from 'ember-primitives/viewport';

import { Callout } from '@universal-ember/docs-support';
import { REPL } from 'limber-ui';
`,
}),
babel({
Expand Down
Loading