starlight-obsidian 0.9.1 → 0.10.1
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/CHANGELOG.md +14 -0
- package/index.ts +14 -0
- package/libs/integration.ts +2 -1
- package/libs/markdown.ts +13 -7
- package/libs/remark.ts +1 -0
- package/libs/starlight.ts +1 -0
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# starlight-obsidian
|
|
2
2
|
|
|
3
|
+
## 0.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#63](https://github.com/HiDeoo/starlight-obsidian/pull/63) [`3e638d4`](https://github.com/HiDeoo/starlight-obsidian/commit/3e638d43b191da7685d59d3bc7d86ec3de4a922f) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Setups trusted publishing using OpenID Connect (OIDC) authentication — no code changes.
|
|
8
|
+
|
|
9
|
+
## 0.10.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#61](https://github.com/HiDeoo/starlight-obsidian/pull/61) [`c4150ef`](https://github.com/HiDeoo/starlight-obsidian/commit/c4150ef713e327f218c5ee0023ba3831e51cfccd) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds a new configuration option `math.singleDollarTextMath` to control whether or not inline math expressions using single dollar signs should be supported or not.
|
|
14
|
+
|
|
15
|
+
This option can be useful to disable support for single dollar inline math expressions which can conflict with “normal” dollars in CommonMark.
|
|
16
|
+
|
|
3
17
|
## 0.9.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/index.ts
CHANGED
|
@@ -45,6 +45,20 @@ const starlightObsidianConfigSchema = z.object({
|
|
|
45
45
|
* @see https://help.obsidian.md/Files+and+folders/Accepted+file+formats
|
|
46
46
|
*/
|
|
47
47
|
ignore: z.array(z.string()).default([]),
|
|
48
|
+
/**
|
|
49
|
+
* Configures math processing options.
|
|
50
|
+
*/
|
|
51
|
+
math: z
|
|
52
|
+
.object({
|
|
53
|
+
/**
|
|
54
|
+
* Whether or not to support inline math expressions using single dollar signs.
|
|
55
|
+
*
|
|
56
|
+
* @default true
|
|
57
|
+
* @see https://github.com/micromark/micromark-extension-math/issues/6#issuecomment-1938838687
|
|
58
|
+
*/
|
|
59
|
+
singleDollarTextMath: z.boolean().default(true),
|
|
60
|
+
})
|
|
61
|
+
.default({}),
|
|
48
62
|
/**
|
|
49
63
|
* The name of the output directory containing the generated Obsidian vault pages relative to the `src/content/docs/`
|
|
50
64
|
* directory.
|
package/libs/integration.ts
CHANGED
|
@@ -15,7 +15,8 @@ export function starlightObsidianIntegration(config: StarlightObsidianConfig): A
|
|
|
15
15
|
updateConfig({
|
|
16
16
|
markdown: {
|
|
17
17
|
rehypePlugins: [rehypeStarlightObsidian, rehypeKatex],
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
remarkPlugins: [[remarkMath, { singleDollarTextMath: config.math.singleDollarTextMath }]],
|
|
19
20
|
},
|
|
20
21
|
vite: {
|
|
21
22
|
plugins: [vitePluginStarlightObsidianConfig(config)],
|
package/libs/markdown.ts
CHANGED
|
@@ -7,19 +7,14 @@ import { VFile } from 'vfile'
|
|
|
7
7
|
|
|
8
8
|
import { remarkStarlightObsidian, type TransformContext } from './remark'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
.data('settings', { resourceLink: true })
|
|
12
|
-
.use(remarkGfm)
|
|
13
|
-
.use(remarkMath)
|
|
14
|
-
.use(remarkFrontmatter)
|
|
15
|
-
.use(remarkStarlightObsidian)
|
|
10
|
+
let processor: ReturnType<typeof remark> | undefined
|
|
16
11
|
|
|
17
12
|
export async function transformMarkdownToString(
|
|
18
13
|
filePath: string,
|
|
19
14
|
markdown: string,
|
|
20
15
|
context: TransformContext,
|
|
21
16
|
): Promise<TransformResult> {
|
|
22
|
-
const file = await
|
|
17
|
+
const file = await getProcessor(context).process(getVFile(filePath, markdown, context))
|
|
23
18
|
|
|
24
19
|
return {
|
|
25
20
|
aliases: file.data.aliases,
|
|
@@ -35,6 +30,17 @@ export async function transformMarkdownToAST(filePath: string, markdown: string,
|
|
|
35
30
|
return fromMarkdown(content)
|
|
36
31
|
}
|
|
37
32
|
|
|
33
|
+
function getProcessor(context: TransformContext): ReturnType<typeof remark> {
|
|
34
|
+
processor ??= remark()
|
|
35
|
+
.data('settings', { resourceLink: true })
|
|
36
|
+
.use(remarkGfm)
|
|
37
|
+
.use(remarkMath, { singleDollarTextMath: context.singleDollarTextMath })
|
|
38
|
+
.use(remarkFrontmatter)
|
|
39
|
+
.use(remarkStarlightObsidian)
|
|
40
|
+
|
|
41
|
+
return processor
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
function getVFile(filePath: string, markdown: string, context: TransformContext) {
|
|
39
45
|
return new VFile({
|
|
40
46
|
data: { ...context },
|
package/libs/remark.ts
CHANGED
|
@@ -785,6 +785,7 @@ export interface TransformContext {
|
|
|
785
785
|
includeYoutubeComponent?: boolean
|
|
786
786
|
isMdx?: true
|
|
787
787
|
output: StarlightObsidianConfig['output']
|
|
788
|
+
singleDollarTextMath: StarlightObsidianConfig['math']['singleDollarTextMath']
|
|
788
789
|
skip?: true
|
|
789
790
|
vault: Vault
|
|
790
791
|
}
|
package/libs/starlight.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-obsidian",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Starlight plugin to publish Obsidian vaults.",
|
|
6
6
|
"author": "HiDeoo <github@hideoo.dev> (https://hideoo.dev)",
|
|
@@ -55,8 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"packageManager": "pnpm@8.14.1",
|
|
57
57
|
"publishConfig": {
|
|
58
|
-
"access": "public"
|
|
59
|
-
"provenance": true
|
|
58
|
+
"access": "public"
|
|
60
59
|
},
|
|
61
60
|
"sideEffects": false,
|
|
62
61
|
"keywords": [
|