mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-15 18:17:35 +02:00
feat(v2): support for adding relative images and handling broken image links (#3069)
* all relative path in image url * throw error if file doesn't present * better error * add @docusaurus/core to deps * fix test
This commit is contained in:
parent
15e73daae7
commit
3155dc30dc
15 changed files with 162 additions and 4 deletions
packages/docusaurus-mdx-loader/src
|
@ -13,6 +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 DEFAULT_OPTIONS = {
|
||||
rehypePlugins: [],
|
||||
|
@ -29,6 +30,10 @@ module.exports = async function (fileString) {
|
|||
remarkPlugins: [
|
||||
...(reqOptions.beforeDefaultRemarkPlugins || []),
|
||||
...DEFAULT_OPTIONS.remarkPlugins,
|
||||
[
|
||||
relativePath,
|
||||
{staticDir: reqOptions.staticDir, filePath: this.resourcePath},
|
||||
],
|
||||
...(reqOptions.remarkPlugins || []),
|
||||
],
|
||||
rehypePlugins: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue