From ba519d7e28cbaefafee56432eb47e2cc2084c32c Mon Sep 17 00:00:00 2001 From: Tuan Cao Date: Thu, 28 Apr 2022 16:44:59 +0700 Subject: [PATCH] WIP: Parsing obsidian image link --- lib/transformer.js | 5 +++-- package.json | 1 + yarn.lock | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/transformer.js b/lib/transformer.js index 6737578..c180570 100644 --- a/lib/transformer.js +++ b/lib/transformer.js @@ -10,7 +10,7 @@ import {Node} from "./node"; import rehypePrism from 'rehype-prism-plus' import remarkRehype from 'remark-rehype' import rehypeStringify from 'rehype-stringify' - +import obsidianImage from './obsidian-image.js' import {getAllMarkdownFiles, toFilePath, toSlug} from "./utils"; export const Transformer = { @@ -62,7 +62,8 @@ export const Transformer = { unified() .use(markdown, {gfm: true}) - .use(highlight) + .use(obsidianImage) + .use(highlight) .use(externalLinks, {target: "_blank", rel: ['noopener']}) .use(frontmatter, ['yaml', 'toml']) .use(wikiLinkPlugin, { diff --git a/package.json b/package.json index ee38c23..75a6caa 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "remark-wiki-link": "^1.0.0", "to-vfile": "^6.1.0", "unified": "^9.2.0", + "unist-util-visit": "^4.1.0", "vfile-reporter": "^6.0.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 3e75333..37b92c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4329,7 +4329,7 @@ unist-util-visit@^3.0.0: unist-util-is "^5.0.0" unist-util-visit-parents "^4.0.0" -unist-util-visit@^4.0.0: +unist-util-visit@^4.0.0, unist-util-visit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-4.1.0.tgz#f41e407a9e94da31594e6b1c9811c51ab0b3d8f5" integrity sha512-n7lyhFKJfVZ9MnKtqbsqkQEk5P1KShj0+//V7mAcoI6bpbUjh3C/OG8HVD+pBihfh6Ovl01m8dkcv9HNqYajmQ==