feat(v2): add support to import assets using relative link in markdown syntax (#3096)

* add a rehyper plugin

* fix yarn.lok

* add target

* convert to remark

* add docs

* remove unused package

* remove file-loader

* add test for file-loader

* fix test
This commit is contained in:
Anshul Goyal 2020-08-03 18:49:12 +05:30 committed by GitHub
parent 64293bf87f
commit 325559933f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 218 additions and 0 deletions

View file

@ -14,6 +14,7 @@ const stringifyObject = require('stringify-object');
const slug = require('./remark/slug');
const rightToc = require('./remark/rightToc');
const transformImage = require('./remark/transformImage');
const tranformAsset = require('./remark/transformAssets');
const DEFAULT_OPTIONS = {
rehypePlugins: [],
@ -34,11 +35,16 @@ module.exports = async function (fileString) {
transformImage,
{staticDir: reqOptions.staticDir, filePath: this.resourcePath},
],
[
tranformAsset,
{staticDir: reqOptions.staticDir, filePath: this.resourcePath},
],
...(reqOptions.remarkPlugins || []),
],
rehypePlugins: [
...(reqOptions.beforeDefaultRehypePlugins || []),
...DEFAULT_OPTIONS.rehypePlugins,
...(reqOptions.rehypePlugins || []),
],
filepath: this.resourcePath,