refactor(v2): async md image transformer + pathname protocol as an escape hatch (#3087)

* async md image transformer + pathname protocol as an escape hatch

* make error messages computer agnostic by using relative paths

* fix error message relative path
This commit is contained in:
Sébastien Lorber 2020-07-21 17:45:06 +02:00 committed by GitHub
parent 3e22c1ae5c
commit 6730590c1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 120 additions and 64 deletions

View file

@ -13,7 +13,7 @@ const matter = require('gray-matter');
const stringifyObject = require('stringify-object');
const slug = require('./remark/slug');
const rightToc = require('./remark/rightToc');
const relativePath = require('./remark/transformImage');
const transformImage = require('./remark/transformImage');
const DEFAULT_OPTIONS = {
rehypePlugins: [],
@ -31,7 +31,7 @@ module.exports = async function (fileString) {
...(reqOptions.beforeDefaultRemarkPlugins || []),
...DEFAULT_OPTIONS.remarkPlugins,
[
relativePath,
transformImage,
{staticDir: reqOptions.staticDir, filePath: this.resourcePath},
],
...(reqOptions.remarkPlugins || []),