-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5d26807
Showing
64 changed files
with
12,981 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint"], | ||
root: true, | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
env: | ||
NODE_VERSION: | ||
NPM_VERSION: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# luma-unified | ||
|
||
> [!WARNING] | ||
> このパッケージが提供するプラグインは私のユースケースに特化したものなので,直接使うのは推奨しません. | ||
> The plugins provided by this package are specific to my use case, so I do not recommend using them directly! | ||
|
||
## ライセンス | ||
|
||
MITとCC0でライセンスされています | ||
|
||
## rehype-add-slug | ||
|
||
各ヘディングに対し,slug化したそのテキストを属性として渡し,それより上位のヘディングのslugも属性に付与するプラグイン | ||
|
||
```ts | ||
import rehypeAddSlug from "@luma-dev/luma-unified/rehype-add-slug"; | ||
``` | ||
|
||
例: 以下の入力に対し, | ||
|
||
```md | ||
# hello world | ||
|
||
## 1. getting started | ||
|
||
## 2. install | ||
|
||
## 3. uninstall | ||
|
||
# description | ||
|
||
## 1. something | ||
|
||
## 2. other | ||
``` | ||
|
||
以下のように変換される | ||
|
||
```js | ||
<h1 slug="hello_world">hello world</h1> | ||
<h2 lastH1Slug="hello_world" slug="1.getting_started">1. getting started</h1> | ||
<h2 lastH1Slug="hello_world" slug="2.install">2. install</h1> | ||
... | ||
``` | ||
|
||
## rehype-replace-text | ||
|
||
句点読点を統一する.「,」「.」を「、」「。」に置き換えるプラグイン. | ||
|
||
```ts | ||
import rehypeReplaceText from "@luma-dev/luma-unified/rehype-replace-text"; | ||
``` | ||
|
||
例: 以下の入力に対し, | ||
|
||
```md | ||
こんにちは,ねこだよ. | ||
``` | ||
|
||
以下のように変換される | ||
|
||
```md | ||
こんにちは、ねこだよ。 | ||
``` | ||
|
||
## remark-term | ||
|
||
用語を参照する記法を追加します.mdx前提です. | ||
|
||
```ts | ||
import remarkTerm from "@luma-dev/luma-unified/remark-term"; | ||
``` | ||
|
||
例: 以下の入力に対し, | ||
|
||
```mdx | ||
[@逆元]を考える. | ||
|
||
{/* 以下のようにすると途中で定義を変えられる */} | ||
<DefMapImp | ||
逆元="群の逆元" | ||
/> | ||
|
||
[@逆元]を考える. | ||
|
||
{/* 通常のリンクでは先頭の@をエスケープする必要がある */} | ||
[\@これもリンク](https://example.com)だよ. | ||
``` | ||
|
||
以下のように変換される | ||
|
||
```mdx | ||
<LumaTerm rawTermRef="逆元" termRef="逆元" gotBy="raw"/>を考える. | ||
|
||
<LumaTerm rawTermRef="逆元" termRef="群の逆元" gotBy="imp"/>を考える. | ||
``` | ||
|
||
`DefMapImp` (implicit) の他に `DefMapExp` (explicit) でも書き換えられる. | ||
それらの振る舞いの違いは利用側に委ねられている. | ||
[remark-frontmatter](https://github.com/remarkjs/remark-frontmatter)を入れた状態でfrontmatterのYAMLで `DefMapExp` か `DefMapImp` を使うと同様に初期化できる | ||
|
||
```mdx | ||
--- | ||
DefMapExp: | ||
DefMapImp: | ||
逆元: 行列の逆元 | ||
--- | ||
``` | ||
|
||
## rehype-katex | ||
|
||
TODO | ||
|
||
```ts | ||
import rehypeKatex from "@luma-dev/luma-unified/rehype-katex"; | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(() => { | ||
delete globalThis[a]; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(() => { | ||
globalThis[a] += "a"; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(() => { | ||
globalThis[a] = ""; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
globalThis[a]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const a = Symbol(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"type": "Program", | ||
"start": 0, | ||
"end": 39, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 38, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start": 0, | ||
"end": 37, | ||
"callee": { | ||
"type": "ArrowFunctionExpression", | ||
"start": 1, | ||
"end": 34, | ||
"id": null, | ||
"expression": false, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 7, | ||
"end": 34, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 11, | ||
"end": 32, | ||
"expression": { | ||
"type": "UnaryExpression", | ||
"start": 11, | ||
"end": 31, | ||
"operator": "delete", | ||
"prefix": true, | ||
"argument": { | ||
"type": "MemberExpression", | ||
"start": 18, | ||
"end": 31, | ||
"object": { | ||
"type": "Identifier", | ||
"start": 18, | ||
"end": 28, | ||
"name": "globalThis" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 29, | ||
"end": 30, | ||
"name": "a" | ||
}, | ||
"computed": true, | ||
"optional": false | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": [], | ||
"optional": false | ||
} | ||
} | ||
], | ||
"sourceType": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"type": "Program", | ||
"start": 0, | ||
"end": 39, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 38, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start": 0, | ||
"end": 37, | ||
"callee": { | ||
"type": "ArrowFunctionExpression", | ||
"start": 1, | ||
"end": 34, | ||
"id": null, | ||
"expression": false, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 7, | ||
"end": 34, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 11, | ||
"end": 32, | ||
"expression": { | ||
"type": "AssignmentExpression", | ||
"start": 11, | ||
"end": 31, | ||
"operator": "+=", | ||
"left": { | ||
"type": "MemberExpression", | ||
"start": 11, | ||
"end": 24, | ||
"object": { | ||
"type": "Identifier", | ||
"start": 11, | ||
"end": 21, | ||
"name": "globalThis" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 22, | ||
"end": 23, | ||
"name": "a" | ||
}, | ||
"computed": true, | ||
"optional": false | ||
}, | ||
"right": { | ||
"type": "Literal", | ||
"start": 28, | ||
"end": 31, | ||
"value": "a", | ||
"raw": "\"a\"" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": [], | ||
"optional": false | ||
} | ||
} | ||
], | ||
"sourceType": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"type": "Program", | ||
"start": 0, | ||
"end": 37, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 36, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start": 0, | ||
"end": 35, | ||
"callee": { | ||
"type": "ArrowFunctionExpression", | ||
"start": 1, | ||
"end": 32, | ||
"id": null, | ||
"expression": false, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 7, | ||
"end": 32, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 11, | ||
"end": 30, | ||
"expression": { | ||
"type": "AssignmentExpression", | ||
"start": 11, | ||
"end": 29, | ||
"operator": "=", | ||
"left": { | ||
"type": "MemberExpression", | ||
"start": 11, | ||
"end": 24, | ||
"object": { | ||
"type": "Identifier", | ||
"start": 11, | ||
"end": 21, | ||
"name": "globalThis" | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"start": 22, | ||
"end": 23, | ||
"name": "a" | ||
}, | ||
"computed": true, | ||
"optional": false | ||
}, | ||
"right": { | ||
"type": "Literal", | ||
"start": 27, | ||
"end": 29, | ||
"value": "", | ||
"raw": "\"\"" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": [], | ||
"optional": false | ||
} | ||
} | ||
], | ||
"sourceType": "module" | ||
} |
Oops, something went wrong.