Skip to content

Commit 09caa4b

Browse files
committed
docs: improve guides
1 parent ddc89e0 commit 09caa4b

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

docs/guides/first-pages/manage-sidebar.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# First Pages >> Managing sidebar ||30
1+
# First Pages >> Managing sidebar || 30
22

33
The sidebar will show all the content of the current section.
44

@@ -33,10 +33,11 @@ eleventyNavigation:
3333
---
3434
```
3535

36+
<!--
3637
You can also look at this live playground:
3738
3839
```js story
39-
import { html } from 'lit-html';
40+
import { html } from '@mdjs/mdjs-preview';
4041
4142
export const headlineConverter = () => html`
4243
<p>
@@ -45,6 +46,7 @@ export const headlineConverter = () => html`
4546
</p>
4647
`;
4748
```
49+
-->
4850

4951
How it then works is very similar to https://www.11ty.dev/docs/plugins/navigation/
5052

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1-
# First Pages >> Use JavaScript ||40
1+
# First Pages >> Use JavaScript || 40
22

3-
You can use `js script` to execute JavaScript (`type="module"`).
3+
If you would like to add JavaScript to a page, you can do it inline using the `script` markdown directive. The script you write runs on the page as a module.
44

5-
````
5+
<!-- prettier-ignore-start -->
6+
~~~markdown
67
```js script
7-
console.log('foo');
8+
const message = 'Hello, World!';
9+
console.log(message);
810
```
9-
````
11+
~~~
12+
<!-- prettier-ignore-end -->
1013

11-
This can be useful for importing web components and using them in Markdown.
14+
Adding the above will log `Hello, World!` to the console without adding a global `message` variable.
1215

13-
````
16+
This can be useful for importing web components and using them in Markdown. Imagine you had some `magic-reveal` element that you wanted to use on a page:
17+
18+
<!-- prettier-ignore-start -->
19+
~~~markdown
1420
```js script
1521
import 'magic-reveal/magic-reveal.js';
22+
```
1623

1724
<magic-reveal>
1825

1926
This text will get magically revealed. I can **still** use Markdown as long as there is an empty line between the opening/closing tags and my text.
2027

2128
</magic-reveal>
22-
```
23-
````
29+
~~~
30+
<!-- prettier-ignore-end -->
31+
32+
## Component Story Format
2433

25-
or you can use `js story`, `js preview-story`, ...
34+
You can also add storybook-style CSF (v2 only) stories to a page using `js story` or `js preview-story`, just make sure to import `html` from `@mdjs/mdjs-preview` instead of from `lit` or `lit-html`.
35+
36+
<!-- prettier-ignore-start -->
37+
~~~markdown
38+
```js story
39+
import { html } from '@mdjs/mdjs-preview';
40+
41+
export const StoryPreview = () => html`
42+
<p>Use stories in Rocket!</p>
43+
`;
44+
```
45+
~~~
46+
<!-- prettier-ignore-end -->

0 commit comments

Comments
 (0)