Skip to content

Commit e31e8be

Browse files
committed
docs: improve docs for presets
1 parent 9978ea7 commit e31e8be

File tree

7 files changed

+157
-78
lines changed

7 files changed

+157
-78
lines changed

docs/docs/index.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ eleventyNavigation:
77

88
Here you will find all the details for each of the packages/systems we offer.
99

10-
You should check out:
10+
## Contents
1111

12-
- [@rocket/launch](./presets/launch.md) which is our default preset
12+
- [Configuration](./configuration/)
13+
- [Overview](./configuration/overview/)
14+
- [Computed Config](./configuration/computed-config/)
15+
- [Service Worker](./configuration/service-worker/)
16+
- [Images](./configuration/images/)
17+
- [Presets](./presets/)
18+
- [Joining Blocks](./presets/joining-blocks/)
19+
- [`@rocket/launch`](./presets/launch/)
20+
- [`@rocket/search`](./presets/search/)
21+
- [`@rocket/blog`](./presets/blog/)
22+
- [Markdown JavaScript](./markdown-javascript/)
23+
- [Overview](./markdown-javascript/overview/)
24+
- [Preview](./markdown-javascript/preview/)
25+
- [Story](./markdown-javascript/story/)
26+
- [Eleventy Plugins](./eleventy-plugins/)
27+
- [Markdown JavaScript (mdjs)](./eleventy-plugins/mdjs-unified/)
28+
- [Tools](./tools/)
29+
- [Plugins Manager](./tools/plugins-manager/)
30+
- [Rollup Config](./tools/rollup-config/)
31+
- [Check HTML Links ](./tools/check-html-links/)

docs/docs/presets/blog.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
1-
# Presets >> Blog ||40
1+
# Presets >> Blog || 40
22

33
Enable writing blog posts within your Rocket site.
44

55
## Installation
66

7-
```bash
7+
<code-tabs collection="package-managers" default-tab="npm">
8+
9+
```bash tab npm
810
npm i @rocket/blog
911
```
1012

13+
```bash tab yarn
14+
yarn add @rocket/blog
15+
```
16+
17+
```bash tab pnpm
18+
pnpm add @rocket/blog
19+
```
20+
21+
</code-tabs>
22+
1123
## Usage
1224

13-
👉 `rocket.config.mjs`
25+
👉 `rocket.config.js`
1426

1527
```js
1628
import { rocketBlog } from '@rocket/blog';

docs/docs/presets/joining-blocks.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Presets >> Joining Blocks ||10
1+
# Presets >> Joining Blocks || 10
22

33
The template system allows for a very granular control of how individual parts will be merged, overwritten or reorderd.
44

55
As a preset you may want to add this to your layout.
66

77
{% raw %}
88

9-
```
9+
```jinja2
1010
<footer id="main-footer">
1111
{% for blockName, blockPath in _joiningBlocks.footer %}
1212
{% include blockPath %}
@@ -22,11 +22,15 @@ This will now render all templates within `_includes/_joiningBlocks/footer/*`.
2222

2323
Let's assume we have a preset with the following files
2424

25+
👉 `_includes/_joiningBlocks/footer/10-first.njk`
26+
2527
```html
26-
<!-- usedPreset/_includes/_joiningBlocks/footer/10-first.njk -->
2728
<p>first</p>
29+
```
30+
31+
👉 `_includes/_joiningBlocks/footer/20-second.njk`
2832

29-
<!-- usedPreset/_includes/_joiningBlocks/footer/20-second.njk -->
33+
```html
3034
<p>second</p>
3135
```
3236

@@ -41,8 +45,9 @@ And it produces this in your website
4145

4246
Now we can add a file which will insert content without needing to overwrite any of the preset file.
4347

48+
👉 `docs/_includes/_joiningBlocks/footer/15-in-between.njk`
49+
4450
```html
45-
<!-- docs/_includes/_joiningBlocks/footer/15-in-between.njk -->
4651
<p>in-between</p>
4752
```
4853

@@ -60,8 +65,9 @@ the final output will be
6065

6166
Now if you want to overwrite you can use the same filename.
6267

68+
👉 `docs/_includes/_joiningBlocks/footer/10-first.njk`
69+
6370
```html
64-
<!-- docs/_includes/_joiningBlocks/footer/10-first.njk -->
6571
<p>updated first</p>
6672
```
6773

@@ -78,8 +84,9 @@ the final output will be
7884

7985
Sometimes you wanna reorder when you overwrite as well
8086

87+
👉 `docs/_includes/_joiningBlocks/footer/30-first.njk`
88+
8189
```html
82-
<!-- docs/_includes/_joiningBlocks/footer/30-first.njk -->
8390
<p>first</p>
8491
```
8592

docs/docs/presets/launch.md

Lines changed: 75 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1-
# Presets >> Launch ||20
1+
---
2+
alerts:
3+
- type: tip
4+
content: Take a tip from me
5+
- type: warning
6+
content: Be *sure* about this...
7+
- type: danger
8+
content: You **really** shouldn't!
9+
---
10+
11+
# Presets >> Launch || 20
212

313
Rocket comes with a preset you will love. Simple, responsive and behaving like native, it sure is going to be a hit among your users.
414

515
## Installation
616

7-
```bash
17+
Install `@rocket/launch` from the NPM repository using your favourite package manager.
18+
19+
<code-tabs collection="package-managers" default-tab="npm">
20+
21+
```bash tab npm
822
npm i @rocket/launch
923
```
1024

11-
👉 `rocket.config.mjs`
25+
```bash tab yarn
26+
yarn add @rocket/launch
27+
```
28+
29+
```bash tab pnpm
30+
pnpm add @rocket/launch
31+
```
32+
33+
</code-tabs>
34+
35+
## Usage
36+
37+
👉 `rocket.config.js`
1238

1339
```js
1440
import { rocketLaunch } from '@rocket/launch';
@@ -20,100 +46,91 @@ export default {
2046

2147
## Data
2248

23-
Most data comes from `site.cjs`.
24-
25-
There is also a specific `rocketLaunch.json`.
49+
The launch preset configures [11ty data](https://www.11ty.dev/docs/data/) using a few overridable files:
2650

27-
The footer data comes from `footer.json`
51+
- `site.cjs`: Responsible for most of the site-wide config
52+
- `rocketLaunch.json`: configures the homepage layout
53+
- `footer.json`: Configures the content of the footer
2854

2955
## Inline Notification
3056

31-
Notification are web components that bring in some styles.
32-
33-
To use them in Markdown you need to write the HTML tag and have it separated by an empty line.
34-
3557
```js script
3658
import '@rocket/launch/inline-notification/inline-notification.js';
3759
```
3860

39-
First you need to import the script
61+
Launch ships with `<inline-notification>`, a custom element that applies some styles similar to "info boxes".
4062

41-
````
63+
To add an inline notification you need to remember to import the element definition:
64+
65+
<!-- prettier-ignore-start -->
66+
~~~markdown
4267
```js script
4368
import '@rocket/launch/inline-notification/inline-notification.js';
4469
```
45-
````
46-
47-
### Tip
48-
49-
<inline-notification type="tip">
70+
~~~
71+
<!-- prettier-ignore-end -->
5072

51-
I am a tip
52-
53-
</inline-notification>
73+
Then you can add your notification to the page. If you want to write the notification's content using markdown, just pad the opening and closing tags with empty lines.
5474

55-
**Usage**
75+
There are three varieties of `<inline-notification>`, "tip", "warning", and "danger"
5676

57-
```md
58-
<inline-notification type="tip">
77+
<style>
78+
#inline-notifications::part(tab) {
79+
text-transform: capitalize;
80+
}
81+
#inline-notifications code-tab::part(content) {
82+
display: grid;
83+
grid-template-columns: 1fr 1fr;
84+
gap: 6px;
85+
}
86+
#inline-notifications code-copy::part(copy-button) {
87+
position: absolute;
88+
top: 10px;
89+
border-radius: 6px;
90+
border: 1px solid var(--primary-lines-color);
91+
}
92+
</style>
5993

60-
I am a tip
94+
<code-tabs id="inline-notifications" default-tab="tip">
6195

62-
</inline-notification>
63-
```
96+
{%for alert in alerts%}
6497

65-
### Modify the Title
98+
<code-tab data-label="{{ alert.type }}" data-id="{{ alert.type }}" no-copy>
6699

67-
To override the title you can provide a property success.
100+
```md copy
101+
<inline-notification type="{{ alert.type }}">
68102

69-
<inline-notification type="tip" title="success">
70-
71-
I am a success message
72-
73-
</inline-notification>
74-
75-
**Usage**
76-
77-
```md
78-
<inline-notification type="tip" title="success">
79-
80-
I am a success message
103+
{{ alert.content | safe }}
81104

82105
</inline-notification>
83106
```
84107

85-
### Warning
108+
<inline-notification type="{{ alert.type }}">
86109

87-
<inline-notification type="warning">
88-
89-
I am a warning
110+
{{ alert.content | safe }}
90111

91112
</inline-notification>
92113

93-
**Usage**
114+
</code-tab>
94115

95-
```md
96-
<inline-notification type="warning">
116+
{%endfor%}
97117

98-
I am a warning
118+
</code-tabs>
99119

100-
</inline-notification>
101-
```
120+
### Modify the Title
102121

103-
### Danger
122+
The notification title defautls to it's type. You can write a custom title with the `title` attribute.
104123

105-
<inline-notification type="danger">
124+
<inline-notification type="tip" title="success">
106125

107-
I am a dangerous message
126+
I am a success message
108127

109128
</inline-notification>
110129

111-
**Usage**
112-
113130
```md
114-
<inline-notification type="danger">
131+
<inline-notification type="tip" title="success">
115132

116-
I am a dangerous message
133+
I am a success message
117134

118135
</inline-notification>
119136
```

docs/docs/presets/search.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
# Presets >> Search ||30
1+
# Presets >> Search || 30
22

33
Add a search for all your static content.
44

55
## Installation
66

7-
```bash
7+
<code-tabs collection="package-managers" default-tab="npm">
8+
9+
```bash tab npm
810
npm i @rocket/search
911
```
1012

11-
👉 `rocket.config.mjs`
13+
```bash tab yarn
14+
yarn add @rocket/search
15+
```
16+
17+
```bash tab pnpm
18+
pnpm add @rocket/search
19+
```
20+
21+
</code-tabs>
22+
23+
## Usage
24+
25+
👉 `rocket.config.js`
1226

1327
```js
1428
import { rocketSearch } from '@rocket/search';
@@ -17,3 +31,13 @@ export default {
1731
presets: [rocketSearch()],
1832
};
1933
```
34+
35+
## Styling
36+
37+
| Property | Default | Description |
38+
| ------------------------------------- | --------- | ------------------------------------ |
39+
| `--rocket-search-background-color` | `#fff` | Search results background color |
40+
| `--rocket-search-input-border-color` | `#dfe1e5` | |
41+
| `--rocket-search-input-border-radius` | `24px` | |
42+
| `--rocket-search-fill-color` | `#000` | Search Icon Color |
43+
| `--rocket-search-highlight-color` | `#6c63ff` | Highlighted search result text color |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"puppeteer": "^9.0.0",
7979
"remark-emoji": "^2.1.0",
8080
"rimraf": "^3.0.2",
81-
"rocket-preset-code-tabs": "^0.1.3",
81+
"rocket-preset-code-tabs": "^0.2.1",
8282
"rollup": "^2.36.1",
8383
"rollup-plugin-terser": "^7.0.2",
8484
"sinon": "^9.2.3",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7643,10 +7643,10 @@ rimraf@^3.0.2:
76437643
dependencies:
76447644
glob "^7.1.3"
76457645

7646-
rocket-preset-code-tabs@^0.1.3:
7647-
version "0.1.3"
7648-
resolved "https://registry.yarnpkg.com/rocket-preset-code-tabs/-/rocket-preset-code-tabs-0.1.3.tgz#2d8e1b89410d1c6d402a5c0e3bc147330105ae54"
7649-
integrity sha512-CbFZcmEY213oXjW7mHxv3D5g4S2uP5TC3zvq2Ae7sGB6QqmDbfVxhTPmM3bI5vPMbQydXo6HFt4nhHpEqS67lQ==
7646+
rocket-preset-code-tabs@^0.2.1:
7647+
version "0.2.1"
7648+
resolved "https://registry.yarnpkg.com/rocket-preset-code-tabs/-/rocket-preset-code-tabs-0.2.1.tgz#19fbdbf05736c5783187d73fc4a95b1df4e88ca5"
7649+
integrity sha512-m1E8u70iyCrcUDE7tghGZlTjzal0mhvQ1ESIbz/i1iRr3Y/t103FtDfnndZWSUaNcaXECsf8e1zn6DKk53YrMg==
76507650
dependencies:
76517651
"@pwrs/mixins" "^0.2.0"
76527652
eleventy-plugin-add-web-component-definitions "^2.0.3"

0 commit comments

Comments
 (0)