Skip to content

Commit 31e8e69

Browse files
committed
fix: Revert "fix: make image plugin aware of the token stream"
This reverts commit ee690da.
1 parent 97668cb commit 31e8e69

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/transform/plugins/images/collect.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
import {Token} from 'markdown-it';
1+
import MarkdownIt from 'markdown-it';
22
import {relative} from 'path';
33

44
import {isLocalUrl} from '../../utils';
55
import {resolveRelativePath} from '../../utilsFS';
6+
import imsize from '../imsize';
67
import {MarkdownItPluginOpts} from '../typings';
78

89
type Options = MarkdownItPluginOpts & {
910
destPath: string;
1011
copyFile: (path: string, dest: string) => void;
1112
singlePage: boolean;
12-
tokenStream: Token[];
1313
};
1414

1515
const collect = (input: string, options: Options) => {
16-
const {root, path, destPath = '', copyFile, singlePage, tokenStream} = options;
16+
const md = new MarkdownIt().use(imsize);
1717

18+
const {root, path, destPath = '', copyFile, singlePage} = options;
19+
const tokens = md.parse(input, {});
1820
let result = input;
1921

20-
tokenStream.forEach((token) => {
22+
tokens.forEach((token) => {
2123
if (token.type !== 'inline') {
2224
return;
2325
}

0 commit comments

Comments
 (0)