@ampless/plugin-highlight 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +87 -0
- package/README.md +87 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +95 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ampless contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
> English: [README.md](./README.md)
|
|
2
|
+
|
|
3
|
+
# @ampless/plugin-highlight
|
|
4
|
+
|
|
5
|
+
[ampless](https://github.com/heavymoons/ampless) 向けシンタックスハイライトプラグイン。CDN から遅延ロードした [highlight.js](https://highlightjs.org/) で、公開サイト上のコードブロックをハイライトします。
|
|
6
|
+
|
|
7
|
+
> **プレリリース / ベータ版。** v1.0 まではマイナーバージョンでも破壊的変更が入る可能性があります。
|
|
8
|
+
|
|
9
|
+
`publicHead` capability 経由でインラインスクリプトを 1 本だけ `<head>` に注入します。公開ページ側でスクリプトが `<pre><code class="language-xxx">`(`language-mermaid` は除外)を走査し、**1 つでも存在する場合のみ** テーマ用スタイルシートを注入したうえで jsDelivr から highlight.js を動的 import して各ブロックをハイライトします。コードブロックの無いページではライブラリもスタイルシートも一切ダウンロードしません。
|
|
10
|
+
|
|
11
|
+
AWS のデータ権限は不要です。ディスクリプタの生成は公開 Next.js プロセスのリクエスト時に行われ、ハイライトはブラウザ上で行われます。`trust_level` は `untrusted`。
|
|
12
|
+
|
|
13
|
+
## インストール
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @ampless/plugin-highlight@beta
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 設定
|
|
20
|
+
|
|
21
|
+
`cms.config.ts` に記述します:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { defineConfig } from 'ampless'
|
|
25
|
+
import highlightPlugin from '@ampless/plugin-highlight'
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
// ...
|
|
29
|
+
plugins: [highlightPlugin()],
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## オプション
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
highlightPlugin({
|
|
37
|
+
version: '11.11.1', // 既定値(固定 x.y.z)
|
|
38
|
+
theme: 'github', // highlight.js のスタイルシート名
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| オプション | デフォルト | 備考 |
|
|
43
|
+
| ---------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `version` | `'11.11.1'` | jsDelivr から読み込む highlight.js のバージョン。`x` / `x.y` / `x.y.z` に一致する必要あり。不正値は `console.warn` してデフォルトにフォールバック。 |
|
|
45
|
+
| `theme` | `'github'` | highlight.js のスタイルシート名(例: `github` / `github-dark` / `atom-one-dark` / `monokai`)。`/^[a-z0-9][a-z0-9-]{0,40}$/` に一致する必要あり。それ以外は `github` にフォールバック。対応する `styles/<theme>.min.css` を CDN から読み込みます。[highlight.js のスタイル一覧](https://github.com/highlightjs/highlight.js/tree/main/src/styles)参照。 |
|
|
46
|
+
|
|
47
|
+
## コードブロックの検出方法
|
|
48
|
+
|
|
49
|
+
描画後の投稿 HTML から `<pre><code class="language-xxx">` を探し、`language-mermaid` は除外します。ampless のツールバーにあるコードブロック単位の **言語エディタ**が `language-*` クラスを付与し、どの本文フォーマットでも同じ形に着地します:
|
|
50
|
+
|
|
51
|
+
| `post.format` | クラスの付き方 |
|
|
52
|
+
| ------------- | ------------------------------------------------------------------------- |
|
|
53
|
+
| `tiptap` | コードブロックノードの `language` 属性 → 描画時に `class="language-ts"`。 |
|
|
54
|
+
| `markdown` | フェンスドブロック ` ```ts ` → `class="language-ts"`。 |
|
|
55
|
+
| `html` | 記述された `<pre><code class="language-ts">` はそのまま保持。 |
|
|
56
|
+
|
|
57
|
+
ハイライトしたい言語をフェンスドブロックに指定します:
|
|
58
|
+
|
|
59
|
+
````markdown
|
|
60
|
+
```ts
|
|
61
|
+
const greet = (name: string) => `Hello, ${name}!`
|
|
62
|
+
```
|
|
63
|
+
````
|
|
64
|
+
|
|
65
|
+
`language-*` クラスの無いブロック(言語指定なしの素の ` ``` ` フェンス)はそのまま残します。
|
|
66
|
+
|
|
67
|
+
## @ampless/plugin-mermaid との共存
|
|
68
|
+
|
|
69
|
+
両プラグインは順序非依存で同時に動作するよう設計されています。本プラグインのセレクタは `code.language-mermaid` を明示的に除外(`:not(.language-mermaid)`)するため、Mermaid の図ソースがシンタックスハイライトされることはありません。`@ampless/plugin-mermaid` はそれらの `<pre>` を描画済み SVG に置換します。ハイライト済みブロックは `:not(.hljs)` で守られるため、二重ハイライトされません。
|
|
70
|
+
|
|
71
|
+
## クライアント側の堅牢性
|
|
72
|
+
|
|
73
|
+
- **冪等な再スキャン** — highlight.js は処理済みブロックに `hljs` クラスを付与し、セレクタは `:not(.hljs)` で守るため、再ハイライトしません。
|
|
74
|
+
- **SPA / App Router 遷移** — head スクリプトは一度だけ実行されますが、`document.body` に張ったデバウンス付き `MutationObserver` が、クライアント遷移で後から挿入された投稿コンテンツを再スキャンします。
|
|
75
|
+
- **失敗時の復旧** — 動的 import が失敗した場合はキャッシュした import Promise を破棄するため次回スキャンで再試行されます。失敗は握り潰さず `console.warn` で報告します。
|
|
76
|
+
- **テーマ用スタイルシート** — ハイライト対象のブロックがある場合のみ、id `ampless-hljs-theme` で一度だけ注入されます。
|
|
77
|
+
|
|
78
|
+
## セキュリティ / CDN に関する注意
|
|
79
|
+
|
|
80
|
+
- **既定バージョンは固定。** 供給網の攻撃面を最小化するため `version` の既定値は厳密な `x.y.z` です。floating な major/minor タグ(例: `'11'`)も指定できますが、その供給網リスクは利用者の責任です。
|
|
81
|
+
- **動的 `import()` には SRI(Subresource Integrity)が効きません。** ライブラリは実行時に jsDelivr から取得され、integrity 固定はできません。ライブラリ / スタイルシートの自前ホスティングは将来のオプションとして検討します。
|
|
82
|
+
- highlight.js はコードブロックのテキスト内容を読み取って再マークアップするだけで、ハイライト対象のソースを実行することはありません。
|
|
83
|
+
|
|
84
|
+
## v1 で対応しないこと
|
|
85
|
+
|
|
86
|
+
- **ビルド時 / サーバサイドハイライトは非対応** — ハイライトはブラウザで行われるため、JS 無効クライアントや初回描画時には未スタイル(ただし可読)のコードが見えます。
|
|
87
|
+
- **ラベル無しブロックの言語自動判定は行いません** — `language-*` クラスのあるブロックのみハイライトします。
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
> 日本語版: [README.ja.md](./README.ja.md)
|
|
2
|
+
|
|
3
|
+
# @ampless/plugin-highlight
|
|
4
|
+
|
|
5
|
+
Syntax-highlighting plugin for [ampless](https://github.com/heavymoons/ampless). Highlights fenced code blocks on the public site using [highlight.js](https://highlightjs.org/) loaded lazily from a CDN.
|
|
6
|
+
|
|
7
|
+
> **Pre-release / beta.** Breaking changes possible in any minor version until v1.0.
|
|
8
|
+
|
|
9
|
+
The plugin injects a single inline script into `<head>` via the `publicHead` capability. On the public page the script scans for `<pre><code class="language-xxx">` blocks (excluding `language-mermaid`) and, **only if at least one exists**, injects the theme stylesheet and dynamically imports highlight.js from jsDelivr to highlight each block. Pages without a code block never download the library or the stylesheet.
|
|
10
|
+
|
|
11
|
+
No AWS data permissions are required — the descriptor is produced at request time in the public Next.js process and the highlighting happens in the browser. The plugin's `trust_level` is `untrusted`.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @ampless/plugin-highlight@beta
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configure
|
|
20
|
+
|
|
21
|
+
In `cms.config.ts`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { defineConfig } from 'ampless'
|
|
25
|
+
import highlightPlugin from '@ampless/plugin-highlight'
|
|
26
|
+
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
// ...
|
|
29
|
+
plugins: [highlightPlugin()],
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
highlightPlugin({
|
|
37
|
+
version: '11.11.1', // pinned default
|
|
38
|
+
theme: 'github', // any highlight.js stylesheet name
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Option | Default | Notes |
|
|
43
|
+
| --------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `version` | `'11.11.1'` | highlight.js version loaded from jsDelivr. Must match `x` / `x.y` / `x.y.z`. Invalid values fall back to the default with a `console.warn`. |
|
|
45
|
+
| `theme` | `'github'` | A highlight.js stylesheet name (e.g. `github`, `github-dark`, `atom-one-dark`, `monokai`). Must match `/^[a-z0-9][a-z0-9-]{0,40}$/`; anything else falls back to `github`. The corresponding `styles/<theme>.min.css` is loaded from the CDN. See the [highlight.js styles list](https://github.com/highlightjs/highlight.js/tree/main/src/styles). |
|
|
46
|
+
|
|
47
|
+
## How code blocks are detected
|
|
48
|
+
|
|
49
|
+
The plugin looks for `<pre><code class="language-xxx">` in the rendered post HTML and skips `language-mermaid`. The ampless toolbar's per-code-block **language editor** writes the `language-*` class, and all body formats land on the same shape:
|
|
50
|
+
|
|
51
|
+
| `post.format` | How the class appears |
|
|
52
|
+
| ------------- | ------------------------------------------------------------------------------------- |
|
|
53
|
+
| `tiptap` | The code-block node carries a `language` attribute → `class="language-ts"` on render. |
|
|
54
|
+
| `markdown` | A fenced block ` ```ts ` → `class="language-ts"`. |
|
|
55
|
+
| `html` | Authored `<pre><code class="language-ts">` is preserved literally. |
|
|
56
|
+
|
|
57
|
+
Tag a fenced block with the language to highlight:
|
|
58
|
+
|
|
59
|
+
````markdown
|
|
60
|
+
```ts
|
|
61
|
+
const greet = (name: string) => `Hello, ${name}!`
|
|
62
|
+
```
|
|
63
|
+
````
|
|
64
|
+
|
|
65
|
+
A block with no `language-*` class (a plain ` ``` ` fence with no language) is left untouched.
|
|
66
|
+
|
|
67
|
+
## Coexistence with @ampless/plugin-mermaid
|
|
68
|
+
|
|
69
|
+
The two plugins are designed to run together in any order. This plugin's selector explicitly excludes `code.language-mermaid` (`:not(.language-mermaid)`), so a Mermaid diagram source is never syntax-highlighted; `@ampless/plugin-mermaid` replaces those `<pre>` blocks with rendered SVG. Already-highlighted blocks are guarded with `:not(.hljs)` so nothing is highlighted twice.
|
|
70
|
+
|
|
71
|
+
## Client-side robustness
|
|
72
|
+
|
|
73
|
+
- **Idempotent re-scan** — highlight.js adds the `hljs` class to processed blocks, and the selector guards on `:not(.hljs)`, so the scan never re-highlights.
|
|
74
|
+
- **SPA / App Router navigation** — the head script runs once, but a debounced `MutationObserver` on `document.body` re-scans when client navigation injects new post content.
|
|
75
|
+
- **Failure recovery** — if the dynamic import fails, the cached import promise is cleared so a later scan retries; failures are reported via `console.warn` rather than swallowed.
|
|
76
|
+
- **Theme stylesheet** — injected once with id `ampless-hljs-theme`, only when a highlightable block is present.
|
|
77
|
+
|
|
78
|
+
## Security / CDN notes
|
|
79
|
+
|
|
80
|
+
- **Pinned default version.** The default `version` is an exact `x.y.z` to minimize supply-chain surface. You may pass a floating major/minor tag (e.g. `'11'`), but the supply-chain risk of a floating tag is your responsibility.
|
|
81
|
+
- **Dynamic `import()` cannot use Subresource Integrity (SRI).** The library is fetched from jsDelivr at runtime; there is no integrity pin. Self-hosting the library / stylesheet is a possible future option.
|
|
82
|
+
- highlight.js only reads and re-marks the text content of code blocks; it does not execute the highlighted source.
|
|
83
|
+
|
|
84
|
+
## What it does not do (v1)
|
|
85
|
+
|
|
86
|
+
- **No build-time / server-side highlighting** — highlighting happens in the browser, so a no-JS client or the first paint shows unstyled (but readable) code.
|
|
87
|
+
- **No automatic language detection for unlabelled blocks** — only blocks with a `language-*` class are highlighted.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AmplessPlugin } from 'ampless';
|
|
2
|
+
|
|
3
|
+
interface HighlightPluginOptions {
|
|
4
|
+
/**
|
|
5
|
+
* highlight.js version to load from jsDelivr. Must be an exact or
|
|
6
|
+
* partial `x` / `x.y` / `x.y.z` version string. Invalid values fall
|
|
7
|
+
* back to the pinned default with a `console.warn`. Floating
|
|
8
|
+
* major/minor tags are accepted but their supply-chain risk is the
|
|
9
|
+
* site author's responsibility.
|
|
10
|
+
*/
|
|
11
|
+
version?: string;
|
|
12
|
+
/**
|
|
13
|
+
* highlight.js stylesheet theme name (e.g. `'github'`,
|
|
14
|
+
* `'github-dark'`, `'atom-one-dark'`). Must match
|
|
15
|
+
* `/^[a-z0-9][a-z0-9-]{0,40}$/`; invalid values fall back to
|
|
16
|
+
* `'github'` with a `console.warn`. The corresponding
|
|
17
|
+
* `styles/<theme>.min.css` is loaded from the CDN.
|
|
18
|
+
*/
|
|
19
|
+
theme?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Factory for the syntax-highlighting plugin. Usage in `cms.config.ts`:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { defineConfig } from 'ampless'
|
|
26
|
+
* import highlightPlugin from '@ampless/plugin-highlight'
|
|
27
|
+
*
|
|
28
|
+
* export default defineConfig({
|
|
29
|
+
* plugins: [highlightPlugin()],
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function highlightPlugin(opts?: HighlightPluginOptions): AmplessPlugin;
|
|
34
|
+
|
|
35
|
+
export { type HighlightPluginOptions, highlightPlugin as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { definePlugin } from "ampless";
|
|
3
|
+
var DEFAULT_VERSION = "11.11.1";
|
|
4
|
+
var DEFAULT_THEME = "github";
|
|
5
|
+
var VERSION_RE = /^[0-9]+(\.[0-9]+){0,2}$/;
|
|
6
|
+
var THEME_RE = /^[a-z0-9][a-z0-9-]{0,40}$/;
|
|
7
|
+
function pickVersion(value) {
|
|
8
|
+
if (value === void 0) return DEFAULT_VERSION;
|
|
9
|
+
if (VERSION_RE.test(value)) return value;
|
|
10
|
+
console.warn(
|
|
11
|
+
`[ampless-highlight] ignoring invalid version "${value}"; falling back to "${DEFAULT_VERSION}".`
|
|
12
|
+
);
|
|
13
|
+
return DEFAULT_VERSION;
|
|
14
|
+
}
|
|
15
|
+
function pickTheme(value) {
|
|
16
|
+
if (value === void 0) return DEFAULT_THEME;
|
|
17
|
+
if (THEME_RE.test(value)) return value;
|
|
18
|
+
console.warn(
|
|
19
|
+
`[ampless-highlight] ignoring invalid theme "${value}"; falling back to "${DEFAULT_THEME}".`
|
|
20
|
+
);
|
|
21
|
+
return DEFAULT_THEME;
|
|
22
|
+
}
|
|
23
|
+
function buildBody(version, theme) {
|
|
24
|
+
const CSS = JSON.stringify(
|
|
25
|
+
`https://cdn.jsdelivr.net/npm/highlight.js@${version}/styles/${theme}.min.css`
|
|
26
|
+
);
|
|
27
|
+
const SRC = JSON.stringify(`https://cdn.jsdelivr.net/npm/highlight.js@${version}/+esm`);
|
|
28
|
+
return `(function () {
|
|
29
|
+
var modPromise;
|
|
30
|
+
function scan() {
|
|
31
|
+
var blocks = Array.prototype.slice.call(
|
|
32
|
+
document.querySelectorAll('pre > code[class*="language-"]:not(.language-mermaid):not(.hljs)')
|
|
33
|
+
);
|
|
34
|
+
if (!blocks.length) return;
|
|
35
|
+
// Inject the theme stylesheet once, only when something needs it.
|
|
36
|
+
if (!document.getElementById('ampless-hljs-theme')) {
|
|
37
|
+
var link = document.createElement('link');
|
|
38
|
+
link.id = 'ampless-hljs-theme';
|
|
39
|
+
link.rel = 'stylesheet';
|
|
40
|
+
link.href = ${CSS};
|
|
41
|
+
document.head.appendChild(link);
|
|
42
|
+
}
|
|
43
|
+
if (!modPromise) modPromise = import(${SRC});
|
|
44
|
+
modPromise.then(function (mod) {
|
|
45
|
+
var hljs = mod.default;
|
|
46
|
+
blocks.forEach(function (code) {
|
|
47
|
+
// Guard again at apply time \u2014 a concurrent scan may have already
|
|
48
|
+
// highlighted this block.
|
|
49
|
+
if (!code.classList.contains('hljs')) hljs.highlightElement(code);
|
|
50
|
+
});
|
|
51
|
+
}).catch(function (e) {
|
|
52
|
+
// Drop the cached import so a later scan re-attempts the load.
|
|
53
|
+
modPromise = undefined;
|
|
54
|
+
console.warn('[ampless-highlight] load failed', e);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function init() {
|
|
58
|
+
scan();
|
|
59
|
+
// SPA / App Router client navigation: the head script runs once but new
|
|
60
|
+
// post content arrives later. Re-scan (debounced) when the body mutates.
|
|
61
|
+
if (typeof MutationObserver === 'function') {
|
|
62
|
+
var t;
|
|
63
|
+
var obs = new MutationObserver(function () {
|
|
64
|
+
clearTimeout(t);
|
|
65
|
+
t = setTimeout(scan, 100);
|
|
66
|
+
});
|
|
67
|
+
obs.observe(document.body, { childList: true, subtree: true });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (document.readyState === 'loading') {
|
|
71
|
+
document.addEventListener('DOMContentLoaded', init);
|
|
72
|
+
} else {
|
|
73
|
+
init();
|
|
74
|
+
}
|
|
75
|
+
})();`;
|
|
76
|
+
}
|
|
77
|
+
function highlightPlugin(opts = {}) {
|
|
78
|
+
const version = pickVersion(opts.version);
|
|
79
|
+
const theme = pickTheme(opts.theme);
|
|
80
|
+
const body = buildBody(version, theme);
|
|
81
|
+
return definePlugin({
|
|
82
|
+
name: "highlight",
|
|
83
|
+
apiVersion: 1,
|
|
84
|
+
packageName: "@ampless/plugin-highlight",
|
|
85
|
+
trust_level: "untrusted",
|
|
86
|
+
capabilities: ["publicHead"],
|
|
87
|
+
displayName: { en: "Syntax highlighting", ja: "\u30B7\u30F3\u30BF\u30C3\u30AF\u30B9\u30CF\u30A4\u30E9\u30A4\u30C8" },
|
|
88
|
+
publicHead() {
|
|
89
|
+
return [{ type: "inlineScript", id: "ampless-highlight", body }];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
highlightPlugin as default
|
|
95
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ampless/plugin-highlight",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Syntax highlighting plugin for ampless — highlights `code.language-*` blocks on the public site via a lazily CDN-loaded highlight.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/heavymoons/ampless.git",
|
|
24
|
+
"directory": "packages/plugin-highlight"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/heavymoons/ampless/tree/main/packages/plugin-highlight#readme",
|
|
27
|
+
"bugs": "https://github.com/heavymoons/ampless/issues",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"ampless": "1.0.0-beta.52"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"ampless",
|
|
33
|
+
"plugin",
|
|
34
|
+
"ampless-plugin",
|
|
35
|
+
"highlight",
|
|
36
|
+
"highlight.js",
|
|
37
|
+
"syntax-highlighting",
|
|
38
|
+
"cms"
|
|
39
|
+
],
|
|
40
|
+
"amplessPlugin": {
|
|
41
|
+
"apiVersion": 1,
|
|
42
|
+
"name": "highlight",
|
|
43
|
+
"trustLevel": "untrusted",
|
|
44
|
+
"capabilities": [
|
|
45
|
+
"publicHead"
|
|
46
|
+
],
|
|
47
|
+
"displayName": {
|
|
48
|
+
"en": "Syntax highlighting",
|
|
49
|
+
"ja": "シンタックスハイライト"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsup",
|
|
54
|
+
"dev": "tsup --watch",
|
|
55
|
+
"lint": "tsc --noEmit",
|
|
56
|
+
"test": "vitest run --passWithNoTests"
|
|
57
|
+
}
|
|
58
|
+
}
|