mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 07:49:43 +02:00
refactor(v2): docs plugin refactor (#3245)
* safe refactorings * safe refactors * add code to read versions more generically * refactor docs plugin * refactors * stable docs refactor * progress on refactor * stable docs refactor * stable docs refactor * stable docs refactor * attempt to fix admonition :( * configureWebpack docs: better typing * more refactors * rename cli * refactor docs metadata processing => move to pure function * stable docs refactor * stable docs refactor * named exports * basic sidebars refactor * add getElementsAround utils * refactor sidebar + ordering/navigation logic * stable retrocompatible refactor * add proper versions metadata tests * fix docs metadata tests * fix docs tests * fix test due to absolute path * fix webpack tests * refactor linkify + add broken markdown links warning * fix DOM warning due to forwarding legacy prop to div element * add todo
This commit is contained in:
parent
d17df954b5
commit
a4c8a7f55b
54 changed files with 3219 additions and 2724 deletions
|
@ -7,26 +7,15 @@
|
|||
|
||||
import {getOptions} from 'loader-utils';
|
||||
import {loader} from 'webpack';
|
||||
import linkify from './linkify';
|
||||
import {linkify} from './linkify';
|
||||
import {DocsMarkdownOption} from '../types';
|
||||
|
||||
const markdownLoader: loader.Loader = function (source) {
|
||||
const fileString = source as string;
|
||||
const callback = this.async();
|
||||
const {docsDir, siteDir, versionedDir, sourceToPermalink} = getOptions(this);
|
||||
|
||||
const options = getOptions(this) as DocsMarkdownOption;
|
||||
return (
|
||||
callback &&
|
||||
callback(
|
||||
null,
|
||||
linkify(
|
||||
fileString,
|
||||
this.resourcePath,
|
||||
docsDir,
|
||||
siteDir,
|
||||
sourceToPermalink,
|
||||
versionedDir,
|
||||
),
|
||||
)
|
||||
callback && callback(null, linkify(fileString, this.resourcePath, options))
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue