Skip to content

Commit acc3c8e

Browse files
committed
cleanup scripts + plugins, switch to psyche for search
1 parent d1f07b6 commit acc3c8e

26 files changed

+299
-816
lines changed

Diff for: .vscode/launch.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"request": "launch",
66
"type": "pwa-node",
7-
"program": "https:/deno.land/x/lume@v1.4.2/cli.ts",
7+
"program": "lume/cli.ts",
88
"cwd": "${workspaceFolder}",
99
"runtimeExecutable": "deno",
1010
"runtimeArgs": [
@@ -20,7 +20,7 @@
2020
{
2121
"request": "launch",
2222
"type": "pwa-node",
23-
"program": "https:/deno.land/x/lume@v1.4.2/cli.ts",
23+
"program": "lume/cli.ts",
2424
"cwd": "${workspaceFolder}",
2525
"runtimeExecutable": "deno",
2626
"runtimeArgs": [

Diff for: .vscode/lume_import_map.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"imports": {
3-
"lume": "https:/deno.land/x/[email protected].2/mod.ts",
4-
"lume/": "https:/deno.land/x/[email protected].2/",
5-
"https://deno.land/x/lume/": "https:/deno.land/x/[email protected].2/"
3+
"lume": "https:/deno.land/x/[email protected].3/mod.ts",
4+
"lume/": "https:/deno.land/x/[email protected].3/",
5+
"https://deno.land/x/lume/": "https:/deno.land/x/[email protected].3/"
66
}
77
}

Diff for: .vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"https://deno.land": true
77
},
88
"deno.importMap": ".vscode/lume_import_map.json"
9-
}
9+
}

Diff for: _config.ts

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import lume from "https:/deno.land/x/lume@v1.4.2/mod.ts";
1+
import lume from "lume";
22

3-
import resolveUrls from "https:/deno.land/x/[email protected]/plugins/resolve_urls.ts";
4-
import codeHighlight from "https:/deno.land/x/[email protected]/plugins/code_highlight.ts";
3+
import resolveUrls from "lume/plugins/resolve_urls.ts";
4+
import codeHighlight from "lume/plugins/code_highlight.ts";
5+
import bundler from "lume/plugins/bundler.ts";
6+
import postcss from "lume/plugins/postcss.ts";
57

6-
import bundler from "https:/deno.land/x/[email protected]/plugins/bundler.ts";
7-
import esbuild from "https://raw.githubusercontent.com/lumeland/experimental-plugins/ad1d4d27ff435197cdb753183447849c7f518ea3/esbuild/esbuild.ts";
8-
import minify from "https://raw.githubusercontent.com/lumeland/experimental-plugins/ad1d4d27ff435197cdb753183447849c7f518ea3/minify/minify.ts";
9-
10-
import windicss from "https://raw.githubusercontent.com/lumeland/experimental-plugins/ad1d4d27ff435197cdb753183447849c7f518ea3/windicss/windicss.ts";
11-
import postcss from "https://deno.land/x/[email protected]/plugins/postcss.ts";
8+
import psyche from "https://deno.land/x/[email protected]/indexers/lume.ts";
129
import featherIcons from "https://cdn.skypack.dev/feather-icons";
1310

11+
import esbuild from "https://raw.githubusercontent.com/lumeland/experimental-plugins/cb94abee21c241ad0b34fc872b3c5985caa0e0a8/esbuild/esbuild.ts";
12+
import minify from "https://raw.githubusercontent.com/lumeland/experimental-plugins/cb94abee21c241ad0b34fc872b3c5985caa0e0a8/minify/minify.ts";
13+
import windicss from "https://raw.githubusercontent.com/lumeland/experimental-plugins/cb94abee21c241ad0b34fc872b3c5985caa0e0a8/windicss/windicss.ts";
14+
1415
import windiConfig from "./_windi.config.ts";
15-
import codeLanguage from "./_plugins/code_language.ts";
16-
import tableOfContentsPlugin from "./_plugins/table_of_contents.ts";
17-
import searchIndexer from "./_plugins/search_indexer.ts";
16+
import codeLabels from "./_plugins/code_labels.ts";
17+
import tableOfContents from "./_plugins/table_of_contents.ts";
1818

1919
export const site = lume({}, {
2020
nunjucks: { includes: "_layouts" },
21-
markdown: { plugins: [codeLanguage], keepDefaultPlugins: true },
21+
markdown: { plugins: [codeLabels], keepDefaultPlugins: true },
2222
});
2323

2424
site.ignore("README.md");
@@ -27,21 +27,28 @@ site.copy("media", "media");
2727
site.copy("assets", "assets");
2828
site.loadAssets([".ts"]);
2929

30-
site.use(tableOfContentsPlugin());
31-
site.use(searchIndexer());
30+
// used for "edit this page" links
31+
site.preprocess([".html"], (page) => {
32+
page.data.filename = page.src.path + page.src.ext;
33+
});
3234

35+
// icons
3336
const feather = (value: string, attrs = {}) =>
3437
featherIcons.icons[value].toSvg(attrs);
3538
site.filter("feather", feather);
39+
40+
// content
41+
site.use(tableOfContents());
3642
site.use(codeHighlight());
43+
site.use(psyche());
3744

45+
// assets
3846
site.use(windicss({
3947
minify: true,
4048
config: windiConfig,
4149
windiLangFiles: "merge",
4250
}));
4351
site.use(postcss());
44-
4552
site.use(resolveUrls());
4653
site.use(bundler());
4754
site.use(esbuild());

Diff for: _data.yml

+31-21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ site_icon: /media/animated.gif
22
site_favicon: /media/colour-x32.png
33
site_embed: /media/colour-x512.png
44

5+
site_banner: false
6+
site_banner_icon:
7+
site_banner_message: notion-enhancer v0.11.0 is now available. Happy new year!
8+
59
site_root: https://notion-enhancer.github.io
610
site_name: notion-enhancer
711
site_description: an enhancer/customiser for the all-in-one productivity workspace notion.so
@@ -26,33 +30,39 @@ nav:
2630
icon: coffee
2731
url: https://github.com/sponsors/dragonwocky
2832

29-
action_buttons:
33+
sidebar:
34+
- getting-started
35+
- advanced
36+
- about
37+
- documentation
38+
- tools
39+
40+
landing_actions:
41+
- action: open-search
42+
icon: search
43+
tooltip: Search
44+
- action: toggle-theme
45+
icon: moon
46+
tooltip: Toggle theme
47+
48+
header_actions:
49+
- action: open-search
50+
icon: search
51+
tooltip: Search
52+
- action: toggle-theme
53+
icon: moon
54+
tooltip: Toggle theme
55+
56+
corner_actions:
3057
- action: toggle-menu
3158
icon: menu
3259
tooltip: Toggle menu
33-
sm_only: true
34-
sm_class: md:(pointer-events-none opacity-0)
60+
breakpoint: md
3561
- action: open-search
3662
icon: search
3763
tooltip: Search
38-
sm_only: false
39-
sm_class: sm:(pointer-events-none opacity-0)
64+
breakpoint: sm
4065
- action: toggle-theme
4166
icon: moon
4267
tooltip: Toggle theme
43-
sm_only: false
44-
sm_class: sm:(pointer-events-none opacity-0)
45-
46-
hotkeys:
47-
- keys: ctrl/⌘ + k
48-
text: to search
49-
- keys: arrows ↑ ↓
50-
text: to navigate
51-
- keys: enter ↵
52-
text: to select
53-
- keys: /
54-
text: to focus
55-
- keys: esc
56-
text: to close
57-
- keys: ctrl/⌘ + shift + l
58-
text: to toggle theme
68+
breakpoint: sm

Diff for: _layouts/base.njk

+5-17
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,13 @@
3131

3232
<body class="min-h-full w-full flex flex-col font-sans bg-body h-full">
3333

34-
<div class="flex items-center bg-purple-500 text-white text-sm font-bold px-4 py-3" role="alert">
35-
{# {{ 'alert-triangle' | feather({ class: "w-4 h-4 mr-4 flex-shrink-0" }) | safe }} #}
36-
<p><span class="mr-1.5">✨</span> notion-enhancer v0.11.0 is now available. Happy new year!</p>
37-
</div>
34+
{% if site_banner %}
35+
<figure class="flex items-center bg-purple-500 text-white text-sm font-bold px-4 py-3" role="banner">
36+
<figcaption><span class="mr-1.5">{{ site_banner_icon }}</span> {{ site_banner_message }}</figcaption>
37+
</figure>
38+
{% endif %}
3839

3940
{{ content | safe }}
4041

41-
<div class="fixed bottom-4 right-4 z-9 flex flex-col">
42-
{% for btn in action_buttons %}
43-
<button data-action="{{ btn.action }}" class="button-floating group {{ btn.sm_class }}">
44-
<span class="tooltip opacity-0 group-hover:opacity-100 right-10 bottom-0">
45-
{{ btn.tooltip }}
46-
</span>
47-
{{ btn.icon | feather | safe }}
48-
</button>
49-
{% endfor %}
50-
</div>
51-
52-
{% include "search.njk" %}
53-
5442
</body>
5543
</html>

Diff for: _layouts/docs.njk

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
---
22
layout: base.njk
3-
4-
sidebar:
5-
- getting-started
6-
- advanced
7-
- about
8-
- documentation
9-
- tools
103
---
114

125
<header class="bg-header border-b-1 border-dim flex justify-center <sm:(pb-4 pt-4.5) sm:py-6">
@@ -16,15 +9,15 @@ sidebar:
169
">
1710
<a href="/" class="flex-shrink-0 grid w-max max-w-full pr-2 flex items-center">
1811
<div class="col-span-1 row-span-2 w-18 mr-4">
19-
<img src="{{ site_icon }}" class="h-18 w-full">
12+
<img src="{{ site_icon }}" class="h-18 w-full" alt="">
2013
</div>
2114
<h1 class="col-start-2 mt-auto font-mono font-bold text-lg">{{ site_name }}</h1>
2215
<p class="col-start-2 mb-auto text-xs max-w-56">{{ site_description }}</p>
2316
</a>
2417
<nav class="sm:ml-auto" aria-label="links">
2518
<ul class="flex flex-row flex-wrap sm:(items-center h-full justify-end) <sm:mt-4">
26-
{% for btn in action_buttons %}
27-
{% if btn.sm_only !== true %}
19+
20+
{% for btn in header_actions %}
2821
<li class="<sm:hidden p-1 group relative flex justify-center">
2922
<button data-action="{{ btn.action }}" class="button !bg-opacity-0 !hover:bg-opacity-50 sm:text-sm">
3023
{{ btn.icon | feather | safe }}
@@ -33,8 +26,8 @@ sidebar:
3326
{{ btn.tooltip }}
3427
</span>
3528
</li>
36-
{% endif %}
3729
{% endfor %}
30+
3831
{% for btn in nav %}
3932
<li class="<sm:(p-0.5 flex-grow text-center) sm:p-1">
4033
<a href="{{ btn.url }}" class="button <sm:(text-xs py-2 px-3 justify-center) sm:text-sm">
@@ -43,6 +36,7 @@ sidebar:
4336
</a>
4437
</li>
4538
{% endfor %}
39+
4640
</ul>
4741
</nav>
4842
</div>
@@ -64,11 +58,11 @@ sidebar:
6458
{% for page in search.pages(section, "order title") %}
6559
<li>
6660
{% if page.data.url == url %}
67-
<a aria-current="page" aria-description="{{ page.data.description }}" href="{{ page.data.url }}"
61+
<a aria-current="page" href="{{ page.data.url }}"
6862
class="border-l border-primary pl-3 py-1 text-sm text-primary"
6963
>{{ page.data.title }}</a>
7064
{% else %}
71-
<a aria-description="{{ page.data.description }}" href="{{ page.data.url }}" class="
65+
<a href="{{ page.data.url }}" class="
7266
border-l border-dim pl-3 py-1 text-sm transition duration-200
7367
text-dim hover:text-primary
7468
">{{ page.data.title }}</a>
@@ -136,3 +130,14 @@ sidebar:
136130
</aside>
137131

138132
</main>
133+
134+
<div class="fixed bottom-4 right-4 z-9 flex flex-col">
135+
{% for btn in corner_actions %}
136+
<button data-action="{{ btn.action }}" class="button-floating group {{ btn.breakpoint }}:(pointer-events-none opacity-0)">
137+
<span class="tooltip opacity-0 group-hover:opacity-100 right-10 bottom-0">
138+
{{ btn.tooltip }}
139+
</span>
140+
{{ btn.icon | feather | safe }}
141+
</button>
142+
{% endfor %}
143+
</div>

Diff for: _layouts/search.njk

-61
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/**
22
* notion-enhancer
3-
* (c) 2021 dragonwocky <[email protected]> (https://dragonwocky.me/)
3+
* (c) 2022 dragonwocky <[email protected]> (https://dragonwocky.me/)
44
* (https://notion-enhancer.github.io/) under the MIT license
55
*/
66

7-
import MarkdownIt from "https://cdn.skypack.dev/markdown-it?dts";
7+
import type MarkdownIt from "https://cdn.skypack.dev/markdown-it?dts";
88

99
// invisible within pages, shows up in search index
10-
const colon = '<span style="display:none">:</span>';
10+
const colon = '<span style="display:none">: </span>';
1111

12-
// displays language or additional meta e.g. filename
12+
// displays language or other meta e.g. filename
1313
// at the top of code blocks
1414
export default (md: MarkdownIt) => {
1515
const fence = md.renderer.rules.fence!;
@@ -20,12 +20,10 @@ export default (md: MarkdownIt) => {
2020
language = info.length ? info.shift() : "",
2121
meta = info.join(" ");
2222
token.info = language;
23-
const html = fence(...args);
23+
const html = fence(...args),
24+
label = `<div>${meta || language}${colon}</div>`;
2425
return meta || language
25-
? html.replace(
26-
/^<pre>/,
27-
`<pre data-has-meta><div>${meta || language}${colon}</div>`,
28-
)
26+
? html.replace(/^<pre>/, `<pre data-labelled>${label}`)
2927
: html;
3028
};
3129
};

Diff for: _plugins/api_indexer.ts renamed to _plugins/indexers/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const index = jsDoc.map((namespace) => {
6868
}).sort((a, b) => a.namespace.localeCompare(b.namespace));
6969

7070
await Deno.writeTextFile(
71-
`${__dirname}/../documentation/_data.json`,
71+
`${__dirname}/../../documentation/_data.json`,
7272
JSON.stringify({
7373
section: "Developer Documentation",
7474
section_order: 4,

0 commit comments

Comments
 (0)