Skip to content

Commit

Permalink
fix: Revert "fix: make image plugin aware of the token stream"
Browse files Browse the repository at this point in the history
This reverts commit ee690da.
  • Loading branch information
3y3 committed Feb 5, 2025
1 parent 97668cb commit 31e8e69
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/transform/plugins/images/collect.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import {Token} from 'markdown-it';
import MarkdownIt from 'markdown-it';
import {relative} from 'path';

import {isLocalUrl} from '../../utils';
import {resolveRelativePath} from '../../utilsFS';
import imsize from '../imsize';
import {MarkdownItPluginOpts} from '../typings';

type Options = MarkdownItPluginOpts & {
destPath: string;
copyFile: (path: string, dest: string) => void;
singlePage: boolean;
tokenStream: Token[];
};

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

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

tokenStream.forEach((token) => {
tokens.forEach((token) => {
if (token.type !== 'inline') {
return;
}
Expand Down

0 comments on commit 31e8e69

Please sign in to comment.