Skip to content

Commit 2a5daac

Browse files
committed
More example improvements
1 parent a9c8951 commit 2a5daac

File tree

7 files changed

+38
-22
lines changed

7 files changed

+38
-22
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,23 @@ export default async function markdownItSettingsOverride (md) {
10461046
}
10471047
```
10481048
1049+
By default, DOMStack ships with the following markdown-it plugins:
1050+
1051+
- ['markdown-it'](https://github.com/markdown-it/markdown-it)
1052+
- ['markdown-it-footnote'](https://github.com/markdown-it/markdown-it-footnote)
1053+
- ['markdown-it-highlightjs'](https://github.com/valeriangalliat/markdown-it-highlightjs)
1054+
- ['markdown-it-emoji'](https://github.com/markdown-it/markdown-it-emoji)
1055+
- ['markdown-it-sub'](https://github.com/markdown-it/markdown-it-sub)
1056+
- ['markdown-it-sup'](https://github.com/markdown-it/markdown-it-sup)
1057+
- ['markdown-it-deflist'](https://github.com/markdown-it/markdown-it-deflist)
1058+
- ['markdown-it-ins'](https://github.com/markdown-it/markdown-it-ins)
1059+
- ['markdown-it-mark'](https://github.com/markdown-it/markdown-it-mark)
1060+
- ['markdown-it-abbr'](https://github.com/markdown-it/markdown-it-abbr)
1061+
- ['markdown-it-task-lists'](https://github.com/revin/markdown-it-task-lists)
1062+
- ['markdown-it-anchor'](https://github.com/valeriangalliat/markdown-it-anchor)
1063+
- ['markdown-it-attrs'](https://github.com/arve0/markdown-it-attrs)
1064+
- ['markdown-it-table-of-contents'](https://github.com/cmaas/markdown-it-table-of-contents)
1065+
10491066
## Variables
10501067
10511068
Pages, Layouts, and `postVars` all receive an object with the following parameters:

examples/css-modules/src/README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,11 @@ CSS module support is provided by esbuild, so for more information on what is an
99

1010
CSS modules are NOT supported in Node.js natively, so you need to import a loader to support them, or only reference them in client bundles.
1111

12-
## What Are CSS Modules?
13-
14-
CSS modules are CSS files where class names and animation names are scoped locally by default. This prevents style leakage and naming collisions in your application.
15-
16-
## Features Demonstrated
17-
18-
- Scoped CSS class names via the `.module.css` extension
19-
- Isomorphic component rendering with Preact
20-
- Integration of CSS modules with JavaScript components
21-
2212
## How It Works
2313

2414
1. Create a CSS file with the `.module.css` extension
25-
2. Import the styles in your JavaScript component
26-
3. Use the imported class names as object properties
15+
2. Import the styles in your JavaScript components that get loaded in your client bundles.
16+
3. Use the imported class names as object properties on the javascript side.
2717

2818
## Project Structure
2919

@@ -41,4 +31,4 @@ src/
4131

4232
## Example
4333

44-
Check out the [Isomorphic Component Rendering](./modules/) example to see CSS modules in action.
34+
Check out the [CSS Modules in a Preact Component](./modules/) example to see CSS modules in action.

examples/css-modules/src/modules/client.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,8 @@ const App = ({ title }) => {
137137
`
138138
}
139139

140-
// Page component for export
141-
export const page = () => html`<${App} title="CSS Modules Demo" />`
142-
143140
// Client-side rendering
144141
if (typeof window !== 'undefined') {
145142
const renderTarget = document.querySelector('.app-main')
146-
render(page(), renderTarget)
143+
render(html`<${App} title="CSS Modules Demo" />`, renderTarget)
147144
}

examples/esbuild-settings/src/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ This example demonstrates how to customize the bundling process in DOMStack by c
1010
- How to configure ESBuild plugins (in this case, for Node.js polyfills)
1111
- How browser code can use Node.js modules safely
1212

13+
## Esbuild build options
14+
15+
The settings file export defaults an async function that receives BuildOptions for esbuild.
16+
The function should modify, extend or replace this BuildOptions object and return it as the return value of the function.
17+
These options are used to build the CSS and client bundles in all of the pages.
18+
19+
- [ESbuild BuildOptions API Docs](https://esbuild.github.io/api/#build)
20+
21+
This is a powerful hook that you can use to modify almost anything about the build with.
22+
However, modifying certain parts of the build options can also break the DOMSTack build.
23+
Proceed with caution!
24+
1325
## How It Works
1426

1527
1. The `client.js` file imports a Node.js built-in module (`os`)

examples/markdown-settings/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ This example demonstrates how to customize the markdown-it instance used for ren
1010

1111
## How it Works
1212

13-
DOMStack now supports a `markdown-it.settings.js` file that allows you to customize the markdown-it instance. This file should export a default function that receives the default markdown-it instance and returns a modified instance.
13+
DOMStack now supports a `markdown-it.settings.js` file that allows you to customize the markdown-it instance. This file should export a default function that receives the default markdown-it instance and returns a modified or replaced instance.
1414

1515
```js
1616
export default async function markdownItSettingsOverride (md) {
1717
// Add plugins
1818
md.use(somePlugin)
19-
19+
2020
// Customize renderers
2121
md.renderer.rules.someRule = function (tokens, idx, options, env, renderer) {
2222
// Custom rendering logic
2323
}
24-
24+
2525
return md
2626
}
2727
```
@@ -70,4 +70,4 @@ This content is hidden by default.
7070

7171
## Further Customization
7272

73-
You can add any markdown-it plugin or customize the rendering of any markdown element by modifying the `markdown-it.settings.js` file. This provides a powerful way to extend the markdown capabilities of your DOMStack site.
73+
You can add any markdown-it plugin or customize the rendering of any markdown element by modifying the `markdown-it.settings.js` file. This provides a powerful way to extend the markdown capabilities of your DOMStack site.

examples/markdown-settings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"devDependencies": {
1313
"@domstack/cli": "file:../../.",
1414
"markdown-it-container": "^4.0.0",
15-
"markdown-it-admonition": "^1.0.4"
15+
"markdown-it-admonition": "1.0.4"
1616
}
1717
}
File renamed without changes.

0 commit comments

Comments
 (0)