Skip to content

Commit 1aae9d2

Browse files
committed
update style
1 parent 305bb0b commit 1aae9d2

10 files changed

Lines changed: 192 additions & 97 deletions

File tree

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@deno/gfm": "jsr:@deno/gfm@^0.11.0",
1616
"@std/front-matter": "jsr:@std/front-matter@^1.0.9",
1717
"@std/http": "jsr:@std/http@^1.0.17",
18+
"cheerio": "npm:cheerio@^1.0.0",
1819
"eta": "npm:eta@^3.5.0",
1920
"livecodes": "npm:livecodes@^0.11.1"
2021
},

deno.lock

Lines changed: 127 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

playground/simple-map/index.html

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<script src="https://tiles.versatiles.org/assets/lib/maplibre-gl/maplibre-gl.js"></script>
5+
<link
6+
href="https://tiles.versatiles.org/assets/lib/maplibre-gl/maplibre-gl.css"
7+
rel="stylesheet"
8+
/>
9+
</head>
310

4-
<head>
5-
<script src="https://tiles.versatiles.org/assets/lib/maplibre-gl/maplibre-gl.js"></script>
6-
<link href="https://tiles.versatiles.org/assets/lib/maplibre-gl/maplibre-gl.css" rel="stylesheet" />
7-
</head>
8-
9-
<body>
10-
<div id="map" style="height: 100vh;"></div>
11-
<script>
12-
new maplibregl.Map({
13-
container: 'map',
14-
style: 'https://tiles.versatiles.org/assets/styles/colorful/style.json',
15-
});
16-
</script>
17-
</body>
18-
19-
</html>
11+
<body>
12+
<div id="map" style="height: 100vh"></div>
13+
<script>
14+
new maplibregl.Map({
15+
container: 'map',
16+
style: 'https://tiles.versatiles.org/assets/styles/colorful/style.json',
17+
});
18+
</script>
19+
</body>
20+
</html>

src/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './generate.ts';
44

55
const fsRoot = (new URL('../docs', import.meta.url)).pathname;
66

7-
Deno.serve((req: Request) => {
7+
Deno.serve({ port: 8080 }, (req: Request) => {
88
if (req.method !== 'GET') return ignore();
99
if (/\.icp$/.test(req.url)) return ignore();
1010

src/generate.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ import { getLiveCodesEmbedOptions } from './lib/livecodes.ts';
33
import { Eta } from 'eta';
44
import { copyAssets } from './lib/utils.ts';
55
import { Example, parseMarkdown } from './lib/markdown.ts';
6-
import { CSS } from '@deno/gfm';
6+
import { Page } from 'https://raw.githubusercontent.com/versatiles-org/versatiles-org.github.io/refs/heads/main/src/cms/page.ts';
77

88
Deno.chdir((new URL('..', import.meta.url)).pathname);
9+
910
try {
1011
Deno.removeSync('./docs', { recursive: true });
11-
} catch (error) {}
12+
} catch (_) { /* */ }
1213

14+
const template = await (await fetch('https://versatiles.org/playground.html')).text();
1315
const eta = new Eta({ views: (new URL('./templates', import.meta.url)).pathname });
1416

1517
const allExamples: Example[] = [];
@@ -29,13 +31,25 @@ for (const example of allExamples) {
2931
copyAssets(`./playground/${slug}`, `./docs/${slug}`);
3032

3133
const playgroundOptions = getLiveCodesEmbedOptions(example);
32-
const editorHTML = eta.render('editor', {
34+
const content = eta.render('page', {
3335
...example,
3436
playgroundOptions,
35-
CSS,
3637
});
37-
Deno.writeTextFileSync(`./docs/${slug}/index.html`, editorHTML);
38+
buildPage(content, `${slug}/index.html`);
3839
}
3940

40-
const overviewHTML = eta.render('overview', { groups });
41-
Deno.writeTextFileSync('./docs/index.html', overviewHTML);
41+
const content = eta.render('index', { groups });
42+
buildPage(content, 'index.html');
43+
44+
function buildPage(content: string, path: string) {
45+
const html = new Page(template)
46+
.setBaseUrl('https://versatiles.org/playground/')
47+
.setContentAttributes({
48+
class: 'markdown-body',
49+
'data-color-mode': 'dark',
50+
'data-light-theme': 'dark',
51+
'data-dark-theme': 'dark',
52+
})
53+
.setContent(content).render();
54+
Deno.writeTextFileSync(`./docs/${path}`, html);
55+
}

src/lib/livecodes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function getLiveCodesConfig(
6565
useTabs: false,
6666
version: '45',
6767
view: 'split',
68-
welcome: true,
68+
welcome: false,
6969
wordWrap: false,
7070
zoom: 1,
7171
};

src/templates/editor.eta

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

0 commit comments

Comments
 (0)