Skip to content

Commit 9f8a8d2

Browse files
authored
Merge branch 'main' into ronith/hide-toggle-terminal-button
2 parents bb85dca + e1e9160 commit 9f8a8d2

File tree

78 files changed

+1801
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1801
-65
lines changed

.github/workflows/integration-test-cli.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,44 @@ name: CLI Integration Tests
33
on:
44
pull_request:
55
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
69

710
jobs:
8-
cli-integration-test:
11+
skip:
912
name: CLI Integration Tests
10-
# Note: `prepare-release.yaml` sets this commit message
11-
if: ${{ contains(github.event.pull_request.title, 'release CLI') || github.event_name == 'workflow_dispatch' }}
1213
runs-on: ubuntu-latest
14+
steps:
15+
- name: skip
16+
run: echo skip
17+
18+
cli-integration-test:
19+
name: CLI Integration Test Matrix
20+
# Note: `prepare-release.yaml` sets this commit message
21+
if: ${{ contains(github.event.pull_request.title, 'release CLI') || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
22+
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest]
28+
node-version: [18, 20, 22]
29+
include:
30+
- os: macos-latest
31+
node_version: 20
32+
- os: windows-latest
33+
node_version: 20.13.1
34+
1335
steps:
1436
- name: Checkout
1537
uses: actions/checkout@v4
1638
with:
1739
fetch-depth: 0
1840

1941
- uses: ./.github/actions/setup-and-build
42+
with:
43+
node-version: ${{ matrix.node-version }}
2044

2145
- name: Update template's versions
2246
working-directory: ./packages/cli

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## [1.1.1](https://github.com/stackblitz/tutorialkit/compare/1.1.0...1.1.1) (2024-10-20)
2+
3+
4+
### Bug Fixes
5+
6+
* **theme:** apply `fast-glob` Windows work-around for all `\@` matches ([#383](https://github.com/stackblitz/tutorialkit/issues/383)) ([9f4bd13](https://github.com/stackblitz/tutorialkit/commit/9f4bd13270f877b9f52e6b85eca5693c283ee249))
7+
8+
9+
10+
# [1.1.0](https://github.com/stackblitz/tutorialkit/compare/1.0.0...1.1.0) (2024-10-18)
11+
12+
13+
### Bug Fixes
14+
15+
* **astro:** correct error message when chapter not found ([#361](https://github.com/stackblitz/tutorialkit/issues/361)) ([0510474](https://github.com/stackblitz/tutorialkit/commit/05104741a73180dbaeb583317cd77df104d2d2c7))
16+
* **astro:** types of override components to optional ([#376](https://github.com/stackblitz/tutorialkit/issues/376)) ([0af3848](https://github.com/stackblitz/tutorialkit/commit/0af384889f5a3e7e46ea4803b1b1a631c15d331f))
17+
* **cli:** list `eject` command in `--help` ([#373](https://github.com/stackblitz/tutorialkit/issues/373)) ([bc61229](https://github.com/stackblitz/tutorialkit/commit/bc61229f156db3043b57dd3f85f09b72702a70b0))
18+
19+
20+
### Features
21+
22+
* add file extension based icons ([#369](https://github.com/stackblitz/tutorialkit/issues/369)) ([ff39cdc](https://github.com/stackblitz/tutorialkit/commit/ff39cdc258764c8d4d1bebe2dce2795fe10e1870))
23+
* **astro:** add `custom` configuration option for passing custom fields ([#378](https://github.com/stackblitz/tutorialkit/issues/378)) ([7c6ede9](https://github.com/stackblitz/tutorialkit/commit/7c6ede95730150b68be763d4c87f1da1bc42503c))
24+
* **astro:** override components to support `HeadTags` ([#375](https://github.com/stackblitz/tutorialkit/issues/375)) ([e93d11a](https://github.com/stackblitz/tutorialkit/commit/e93d11a11b8a01dc6de859842b0dc675b01008de))
25+
26+
27+
128
# [1.0.0](https://github.com/stackblitz/tutorialkit/compare/0.2.3...1.0.0) (2024-10-01)
229

330

docs/demo/src/content/tutorial/1-forms-css/2-colors/1-accent-color/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ slug: accent-color
99

1010
<img src="/images/accent-color.png" class="h-20 m-auto">
1111

12-
In the Preview window, we've displayed several native elements: different `input` types and a `progress` bar. Depending on your operating system settings, these will have a different defalut colors.
12+
In the Preview window, we've displayed several native elements: different `input` types and a `progress` bar. Depending on your operating system settings, these will have a different default colors.
1313

1414
Such colors might not fit your brand, or the current theme of your application.
1515

docs/demo/src/content/tutorial/1-forms-css/3-fieldset/6-the-end/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ focus: /style.css
66
---
77
You've reached the end of this tutorial! We hope you've enjoyed it and learned something new about working with CSS and forms.
88

9-
This app was built using the TutorialKit framework and you can make a similiar learning resource for your team or open-source community yourself! TutorialKit provides all the necessary tooling, and UI out of the box, so that you can focus on the content.
9+
This app was built using the TutorialKit framework and you can make a similar learning resource for your team or open-source community yourself! TutorialKit provides all the necessary tooling, and UI out of the box, so that you can focus on the content.
1010

1111
To learn more, visit <a href="https://tutorialkit.dev">tutorialkit.dev</a>.

docs/tutorialkit.dev/src/content/docs/guides/creating-content.mdx

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,105 @@ src/templates
144144
│ # Overrides "index.js" from "shared-template"
145145
└── index.js
146146
```
147+
148+
## Markdown and MDX Support
149+
150+
TutorialKit comes with built-in support for both Markdown and MDX, powered by Astro. This means you can leverage all Markdown and MDX features when creating lesson content. To explore the full capabilities, check out Astro's [Markdown support](https://docs.astro.build/en/guides/markdown-content/) and [MDX support](https://docs.astro.build/en/guides/integrations-guide/mdx/) documentation for more details.
151+
152+
### Callouts
153+
154+
Callouts are visual elements designed to highlight specific information or provide additional context within a document or user interface. They are ideal for drawing attention to important tips, warnings, and other key messages.
155+
156+
You can create callouts using the following types: `tip`, `info`, `warn`, `danger` and `success`.
157+
158+
```
159+
:::info
160+
Some info with some markdown `syntax` and a [`link`](https://tutorialkit.dev/).
161+
162+
Here's a normal [link](https://tutorialkit.dev/).
163+
:::
164+
```
165+
166+
![Content](../reference/images/theming-callout.png)
167+
168+
To customize the styles of a callout, check out the [theming reference](/reference/theming/#callouts).
169+
170+
171+
### Code blocks
172+
173+
TutorialKit offers a comprehensive set of code block features powered by Expressive Code. It includes all core features, along with optional plugins like collapsible sections and line numbers. For a full overview, check out the [Expressive Code documentation](https://expressive-code.com/).
174+
175+
````md title="content.md"
176+
```js title="code.js" ins={4} del={5} {6} "greeting"
177+
const greeting = 'Hello, World!';
178+
179+
// This is a comment
180+
const added = 'This line was added';
181+
const removed = 'This line was removed';
182+
const highlighted = 'This line is highlighted';
183+
```
184+
````
185+
186+
```js title="code.js" ins={4} del={5} {6} "greeting"
187+
const greeting = 'Hello, World!';
188+
189+
// This is a comment
190+
const added = 'This line was added';
191+
const removed = 'This line was removed';
192+
const highlighted = 'This line is highlighted';
193+
```
194+
195+
#### Useful Expressive Code Attributes
196+
197+
- **`title`** - Sets the title of the code block.
198+
- **`frame`** - Defines the frame of the code block. Options: `"code"`, `"terminal"`, `"none"`, `"auto"`.
199+
- **`showLineNumbers`** - Displays line numbers. You can combine this with `startLineNumber=#` to begin numbering from a specific line.
200+
- **`wrap`** - Controls word wrapping. Use `preserveIndent` and `preserveIndent=false` to adjust indentation handling.
201+
202+
##### Marking Lines
203+
204+
- **`{x}`** - Marks specific lines. For example, `{6,10-18}` will mark lines 6 and 10 through 18.
205+
- **`ins`** - Marks inserted lines. Example: `ins={6,10-18}`.
206+
- **`del`** - Marks deleted lines. Example: `del={6,10-18}`.
207+
- **`{"Label":x}`** - Assigns a label to a line or range of lines. Works with `mark`, `ins`, and `del`. Example: `{"Label1":5} del={"Label2":7-8} ins={"Label3":10-12}`. If the label is long, consider placing an empty line in the code for better readability.
208+
- **`collapse={X-Y}`** - Collapses the specified lines. Example: `collapse={1-5,12-14}`.
209+
210+
##### Marking Text
211+
212+
You can highlight text using strings or regular expressions. For example:
213+
214+
````md
215+
```jsx "hello" /ye[sp]/ add=/add[12]/ del=/remove[12]/
216+
console.log(
217+
'Hello, the words yes and yep will be marked. Also add1, add2, remove1, remove2',
218+
)
219+
```
220+
````
221+
222+
```jsx "hello" /ye[sp]/ add=/add[12]/ del=/remove[12]/
223+
console.log(
224+
'Hello, the words yes and yep will be marked. Also add1, add2, remove1, remove2',
225+
)
226+
```
227+
228+
#### Importing files
229+
230+
In addition to Expressive Code features, you can import files from your code template `_files` and `_solution` folders using the file or solution shortcodes. These shortcodes insert the content of the specified file directly into your lesson content.
231+
232+
- `file` shortcode is used to reference files from the lesson `_files` or code template folder.
233+
- `solution` shortcode is used to reference files from the lesson `_solution` folder.
234+
235+
For example, the following code will insert the content of the `box.css` file from the `_files` folder:
236+
237+
````md "file"
238+
```file:/box.css
239+
```
240+
````
241+
242+
```css
243+
.box {
244+
width: 100px;
245+
height: 100px;
246+
background-color: red;
247+
}
248+
```

docs/tutorialkit.dev/src/content/docs/guides/overriding-components.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,22 @@ interface Props {
8989
/** Content of the dialog */
9090
children: ReactNode;
9191
}
92+
```
93+
94+
### HeadTags
95+
96+
Component for overriding title, links and metadata in the `<head>` tag.
97+
98+
When overriding `HeadTags` you can place TutorialKit's default components using following [Astro slots](https://docs.astro.build/en/basics/astro-components/#named-slots):
99+
100+
- `title`: The page title
101+
- `links`: Links for the favicon, fonts and other assets
102+
- `meta`: Metadata and Open Graph tags
103+
104+
```jsx title="src/components/CustomHeadLinks.astro"
105+
<slot name="title" />
106+
<slot name="links" />
107+
<slot name="meta" />
108+
{/** Add your own tags */}
109+
<link rel="sitemap" href="/sitemap-index.xml" />
92110
```

docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ editor: # Editor is visible
221221
222222
##### `previews`
223223
Configure which ports should be used for the previews allowing you to align the behavior with your demo application's dev server setup. If not specified, the lowest port will be used.
224-
225-
<PropertyTable inherited type={'Preview[]'} />
224+
Optionally you can hide the preview by providing `previews: false`.
225+
<PropertyTable inherited type={'Preview[] | false'} />
226226

227227
The `Preview` type has the following shape:
228228

@@ -246,6 +246,9 @@ previews:
246246
- [3003, "Dev Server", "/docs"] # Preview is on :3003/docs/. Displayed title is "Dev Server".
247247
- { port: 3004, title: "Dev Server" } # Preview is on :3004/. Displayed title is "Dev Server".
248248
- { port: 3005, title: "Dev Server", pathname: "/docs" } # Preview is on :3005/docs/. Displayed title is "Dev Server".
249+
250+
previews: false # Do not show preview panel
251+
249252
```
250253

251254
##### `mainCommand`
@@ -403,3 +406,99 @@ type OpenInStackBlitz =
403406
type TemplateType = "html" | "node" | "angular-cli" | "create-react-app" | "javascript" | "polymer" | "typescript" | "vue"
404407
405408
```
409+
410+
##### `meta`
411+
412+
Configures `<meta>` tags for Open Graph protocole and Twitter.
413+
TutorialKit will use your logo as the default image.
414+
<PropertyTable inherited type="MetaTagsSchema" />
415+
416+
The `MetaTagsSchema` type has the following shape:
417+
418+
```ts
419+
type MetaTagsSchema = {
420+
image?: string;
421+
description?: string;
422+
title?: string;
423+
}
424+
425+
```
426+
427+
Example value:
428+
```yaml
429+
meta:
430+
image: /cover.png
431+
title: Title shown on social media and search engines
432+
description: Description shown on social media and search engines
433+
```
434+
435+
:::tip
436+
If your logo uses the SVG format, it may not display on most social platforms.
437+
Use a raster format instead, such as WEBP or PNG.
438+
:::
439+
440+
##### `custom`
441+
442+
Assign custom fields to a chapter/part/lesson.
443+
<PropertyTable inherited type="Record<string,any>" />
444+
445+
This is useful when you want to consume items for the default `tutorial` collection
446+
in order to implement custom features.
447+
448+
```yaml
449+
custom:
450+
publishedAt: 2024-16-10
451+
tags: tutorialkit,astro,vite
452+
```
453+
454+
```ts
455+
import { getCollection } from 'astro:content';
456+
const collection = await getCollection('tutorial');
457+
for (const entry of collection) {
458+
console.log("This part was published at:", entry.data?.custom?.publishedAt)
459+
}
460+
```
461+
462+
## Configure the Tutorialkit Astro integration
463+
464+
`@tutorialkit/astro` is an integration for Astro. You can configure the integration in your `astro.config.ts` file.
465+
466+
```ts "tutorialkit()" title="astro.config.ts"
467+
import tutorialkit from "@tutorialkit/astro";
468+
import { defineConfig } from "astro/config";
469+
470+
export default defineConfig({
471+
devToolbar: {
472+
enabled: false,
473+
},
474+
integrations: [
475+
tutorialkit(),
476+
],
477+
});
478+
```
479+
480+
You can pass the following options to the `tutorialkit` integration:
481+
482+
### `components`
483+
484+
**type**: `OverrideComponentsOptions`
485+
486+
Provide the path to the components you want to override.
487+
488+
```ts
489+
tutorialkit({
490+
components: {
491+
TopBar: './src/components/CustomTopBar.astro',
492+
},
493+
});
494+
```
495+
496+
See [Overriding Components](/guides/overriding-components/) for details of all the components that you can override.
497+
498+
### `defaultRoutes`
499+
500+
**type**: `boolean | "tutorial-only"`<br/>
501+
**default**: `true`
502+
503+
Controls whether the tutorial routes are automatically added to your project. When set to `true`, it additionally adds a redirect from `/` to the first tutorial.
504+
Use `"tutorial-only"` to only add the tutorial routes without the redirect.

docs/tutorialkit.dev/src/content/docs/reference/theming.mdx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,10 @@ The content refers to the main part of the lesson that contains the text and ima
7777

7878
### Callouts
7979

80-
Callouts are visual elements used to draw attention to specific information or provide additional context within a document or user interface. They are typically used to highlight important tips, warnings, or other types of messages.
81-
82-
For instanceof, here's an example of an info callout.
80+
Customize the appearance of each callout type by adjusting its specific style tokens. Each callout includes tokens for elements such as text color, title color, icon color, background, code snippet color, and border color.
8381

8482
![Content](./images/theming-callout.png)
8583

86-
Callouts are created like this:
87-
88-
```
89-
:::tip
90-
This is a tip
91-
:::
92-
```
93-
94-
Valid callout names are `tip`, `info`, `warn` and `danger`.
95-
9684
#### Tip
9785

9886
| Token | Description |

e2e/configs/override-components.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
components: {
1111
Dialog: './src/components/Dialog.tsx',
1212
TopBar: './src/components/TopBar.astro',
13+
HeadTags: './src/components/CustomHeadTags.astro',
1314
},
1415
}),
1516
],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<slot name="title" />
2+
<slot name="links" />
3+
<slot name="meta" />
4+
<meta name="e2e-test-custom-meta-tag" content="custom-content" />
5+
<link rel="sitemap" href="/sitemap-index.xml" />

0 commit comments

Comments
 (0)