@dogsbay/format-obsidian 0.2.0-beta.153 → 0.2.0-beta.155
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/dist/cli.js +8 -4
- package/dist/serialize.js +6 -2
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -37,6 +37,8 @@ export const plugin = {
|
|
|
37
37
|
for (const mount of mounts ?? []) {
|
|
38
38
|
if (!existsSync(mount.dir))
|
|
39
39
|
continue;
|
|
40
|
+
// Folders the mount leaves out (VitePress: `public/`, a mount of its own)
|
|
41
|
+
const skipped = new Set((mount.skip ?? []).map((f) => join(mount.dir, f)));
|
|
40
42
|
// The mount carries the root its refs were rewritten to — `_assets`
|
|
41
43
|
// for an imported corpus, `images`/`assets` for hand-authored content.
|
|
42
44
|
// Hardcoding `_assets` here would copy the file somewhere the
|
|
@@ -50,10 +52,10 @@ export const plugin = {
|
|
|
50
52
|
// buries hundreds of duplicate .md/.mdx notes under _assets/. Take only
|
|
51
53
|
// the media, matching format-dogsbay-md's copyMediaTree.
|
|
52
54
|
if (mount.mediaOnly) {
|
|
53
|
-
copyMediaTree(mount.dir, dest);
|
|
55
|
+
copyMediaTree(mount.dir, dest, skipped);
|
|
54
56
|
continue;
|
|
55
57
|
}
|
|
56
|
-
cpSync(mount.dir, dest, { recursive: true });
|
|
58
|
+
cpSync(mount.dir, dest, { recursive: true, filter: (src) => !skipped.has(src) });
|
|
57
59
|
}
|
|
58
60
|
// Co-located images from the source docs directory (the mkdocs shape,
|
|
59
61
|
// where media sits next to the markdown rather than in its own tree).
|
|
@@ -261,11 +263,13 @@ const MEDIA_EXTS = new Set([
|
|
|
261
263
|
* mount theirs that way), so a recursive copy would bury every `.md`/`.mdx` in
|
|
262
264
|
* the source under `_assets/` as duplicate notes.
|
|
263
265
|
*/
|
|
264
|
-
function copyMediaTree(srcDir, destDir) {
|
|
266
|
+
function copyMediaTree(srcDir, destDir, skip) {
|
|
265
267
|
for (const entry of readdirSync(srcDir, { withFileTypes: true })) {
|
|
266
268
|
const full = join(srcDir, entry.name);
|
|
269
|
+
if (skip?.has(full))
|
|
270
|
+
continue;
|
|
267
271
|
if (entry.isDirectory()) {
|
|
268
|
-
copyMediaTree(full, join(destDir, entry.name));
|
|
272
|
+
copyMediaTree(full, join(destDir, entry.name), skip);
|
|
269
273
|
continue;
|
|
270
274
|
}
|
|
271
275
|
const dot = entry.name.lastIndexOf(".");
|
package/dist/serialize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { walkInline, applyTextFlags, renderLeaf, prefixLines, pickCodeFence, stripHtml, inlineHtmlToMarkdown, escapeMarkdownText, isSafeHref, codeSpan, markdownDestination, markdownTitle, markdownLatex, footnoteLabel, mapOutsideCodeSpans, neutralizeMarkdown, renderAroundGroup, } from "@dogsbay/serialize-core";
|
|
1
|
+
import { walkInline, applyTextFlags, renderLeaf, prefixLines, pickCodeFence, stripHtml, inlineHtmlToMarkdown, escapeMarkdownText, isSafeHref, codeSpan, markdownDestination, markdownTitle, markdownLatex, footnoteLabel, mapOutsideCodeSpans, neutralizeMarkdown, renderAroundGroup, taskMarker, } from "@dogsbay/serialize-core";
|
|
2
2
|
/**
|
|
3
3
|
* Transform an href for Obsidian vault paths.
|
|
4
4
|
*
|
|
@@ -628,8 +628,12 @@ function listItemToObsidian(node) {
|
|
|
628
628
|
// A list item's text is in `inline` (flat parser shape); nested blocks are
|
|
629
629
|
// in `children`. Reading only children returned "" for every plain bullet.
|
|
630
630
|
const parts = [];
|
|
631
|
+
// a task item's `[ ]` / `[x]` leads (Obsidian draws it as a checkbox)
|
|
632
|
+
const box = taskMarker(node);
|
|
631
633
|
if (node.inline && node.inline.length > 0)
|
|
632
|
-
parts.push(inlineToObsidian(node.inline));
|
|
634
|
+
parts.push(box + inlineToObsidian(node.inline));
|
|
635
|
+
else if (box)
|
|
636
|
+
parts.push(box.trimEnd());
|
|
633
637
|
if (node.children)
|
|
634
638
|
parts.push(...node.children.map(nodeToObsidian).filter(Boolean));
|
|
635
639
|
// Blank line between blocks so Obsidian treats consecutive blockquote-style
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dogsbay/format-obsidian",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.155",
|
|
4
4
|
"description": "Obsidian format plugin for Dogsbay — import/export Obsidian vaults via TreeNode[]",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"@types/node": "^25.9.5",
|
|
24
24
|
"typescript": "^5.9.3",
|
|
25
25
|
"vitest": "^4.1.10",
|
|
26
|
-
"@dogsbay/format-
|
|
27
|
-
"@dogsbay/format-
|
|
26
|
+
"@dogsbay/format-openapi": "0.2.0-beta.155",
|
|
27
|
+
"@dogsbay/format-dogsbay-md": "0.2.0-beta.155"
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@dogsbay/serialize-core": "0.2.0-beta.
|
|
32
|
-
"@dogsbay/types": "0.2.0-beta.
|
|
31
|
+
"@dogsbay/serialize-core": "0.2.0-beta.155",
|
|
32
|
+
"@dogsbay/types": "0.2.0-beta.155"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|