Skip to content

Commit b67633e

Browse files
committed
docs: implement basic structure for docs
1 parent ab44276 commit b67633e

File tree

9 files changed

+107
-17
lines changed

9 files changed

+107
-17
lines changed

docs/_layout.hbs

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/_layout.mustache

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<html lang='en'>
2+
<head>
3+
<meta charset='UTF-8' />
4+
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
5+
<title>@tinytown/pub | A tiny pre-processor for tiny websites</title>
6+
<link rel='stylesheet' href='styles.css' />
7+
</head>
8+
<body class='p-2 mx-auto max-w-3xl'>
9+
{{#showBack}}
10+
<header
11+
class='flex items-center mb-8 h-10 border-b border-b-zinc-100 shadow-b'
12+
>
13+
<nav>
14+
<a href='/'>&larr; Home</a>
15+
</nav>
16+
</header>
17+
{{/showBack}}
18+
<article class='prose prose-zinc'>
19+
{{{content}}}
20+
</article>
21+
<footer class='mt-10'>
22+
Built with ❤️ at
23+
<a
24+
href='https://tinytown.studio/'
25+
class='underline underline-offset-4'
26+
>tinytown.studio</a>
27+
</footer>
28+
<script src='highlight.mjs' type='module'></script>
29+
</body>
30+
</html>

docs/getting-started.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1+
---
2+
showBack: true
3+
---
4+
15
# Getting Started
6+
7+
## Basics
8+
9+
### Install
10+
11+
```sh
12+
npm install -D @tinytown/pub
13+
```
14+
15+
### Usage
16+
17+
```sh
18+
# dev server
19+
npx -p @tinytown/pub pub ./src
20+
21+
# build assets
22+
npx -p @tinytown/pub pub ./dist
23+
```
24+
25+
## Features
26+
27+
- JS Support
28+
- JSX (Defaults to `preact`)
29+
- ESM by default
30+
- Markdown
31+
- Custom Layouts
32+
- Base URL Support
33+
- Front matter
34+
- HTML
35+
- Minifier
36+
- Base URL Support
37+
- CSS
38+
- Full PostCSS Support
39+
- Comes with postcss-import support (bundles css from `node_module`)
40+
41+
[Guide &rarr;](guide)

docs/guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#### TBD

docs/highlight.mjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { createHighlighter } from 'shiki'
2+
3+
const theme = 'min-dark'
4+
const possibleCodeElements = document.querySelectorAll('pre > code')
5+
6+
const highlighter = await createHighlighter({
7+
langs: ['js', 'css', 'html', 'bash'],
8+
themes: [theme],
9+
})
10+
11+
possibleCodeElements.forEach(async (el) => {
12+
const hasLangDef = [...el.classList.entries()].find((d) =>
13+
d[1].includes('language-'),
14+
)
15+
if (!hasLangDef) return
16+
17+
const [, langClass] = hasLangDef
18+
const [, language] = langClass.split('-')
19+
20+
el.parentElement.classList.add('not-prose')
21+
22+
const output = highlighter.codeToHtml(el.innerHTML, {
23+
lang: language,
24+
theme: theme,
25+
})
26+
27+
el.parentElement.outerHTML = output
28+
})

docs/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
A tiny pre-processor for tiny websites
44

5-
[Getting Started](./getting-started)
6-
7-
Built with ❤️ at [tinytown.studio](https://tinytown.studio/)
5+
- [Getting Started](./getting-started)
6+
- [Guide](./guide)

docs/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
"autoprefixer": "^10.4.20",
1717
"tailwind": "^4.0.0",
1818
"tailwindcss": "^3.4.15"
19+
},
20+
"dependencies": {
21+
"shiki": "^1.24.0"
1922
}
2023
}

docs/styles.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import 'highlight.js/styles/1c-light.min.css';
2+
13
@tailwind base;
24
@tailwind utilities;
35
@tailwind components;

docs/tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @type {import('tailwindcss').Config} */
22
module.exports = {
3-
content: ['./**/*.{html,md,js,hbs}', '!./node_modules'],
3+
content: ['./**/*.{html,md,js,mustache}', '!./node_modules'],
44
theme: {
55
extend: {},
66
},

0 commit comments

Comments
 (0)