-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor($core): separate markdown and markdown-loader from core
- Loading branch information
Showing
59 changed files
with
283 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict' | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const createMarkdown = require('@vuepress/markdown') | ||
|
||
/** | ||
* Expose createMarkdown. | ||
*/ | ||
|
||
module.exports = function (ctx) { | ||
const { markdown: markdownConfig = {}} = ctx.siteConfig | ||
const { chainMarkdown, extendMarkdown } = markdownConfig | ||
|
||
const beforeInstantiate = config => { | ||
chainMarkdown && chainMarkdown(config) | ||
ctx.pluginAPI.options.chainMarkdown.syncApply(config) | ||
} | ||
|
||
const afterInstantiate = md => { | ||
extendMarkdown && extendMarkdown(md) | ||
ctx.pluginAPI.options.extendMarkdown.syncApply(md) | ||
} | ||
|
||
return createMarkdown( | ||
Object.assign(markdownConfig, { | ||
beforeInstantiate, | ||
afterInstantiate | ||
}) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__tests__ | ||
__mocks__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# @vuepress/markdown-loader | ||
|
||
> markdown-loader for vuepress | ||
## Usage | ||
|
||
```js | ||
const rule = config.module | ||
.rule('markdown') | ||
.test(/\.md$/) | ||
|
||
rule | ||
.use('vue-loader') | ||
.loader('vue-loader') | ||
.options({ /* ... */ }) | ||
|
||
rule | ||
.use('markdown-loader') | ||
.loader(require.resolve('@vuepress/markdown-loader')) | ||
.options({ | ||
markdown: /* instance created by @vuepress/markdown */, | ||
sourceDir: /* root source directory of your docs */, | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@vuepress/markdown-loader", | ||
"version": "1.0.0", | ||
"description": "markdown-loader for vuepress", | ||
"main": "index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/vuejs/vuepress.git" | ||
}, | ||
"keywords": [ | ||
"documentation", | ||
"vue", | ||
"vuepress", | ||
"generator" | ||
], | ||
"dependencies": { | ||
"@vuepress/markdown": "1.0.0", | ||
"loader-utils": "^1.1.0" | ||
}, | ||
"author": "Evan You", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/vuejs/vuepress/issues" | ||
}, | ||
"homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/markdown-loader#readme" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__tests__ | ||
__mocks__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @vuepress/markdown | ||
|
||
> markdown for vuepress |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...core/__test__/markdown/containers.spec.js → ...ess/markdown/__tests__/containers.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../core/__test__/markdown/highlight.spec.js → ...ress/markdown/__tests__/highlight.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../__test__/markdown/highlightLines.spec.js → ...markdown/__tests__/highlightLines.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ress/core/__test__/markdown/hoist.spec.js → ...vuepress/markdown/__tests__/hoist.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...core/__test__/markdown/lineNumers.spec.js → ...ess/markdown/__tests__/lineNumers.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...press/core/__test__/markdown/link.spec.js → ...@vuepress/markdown/__tests__/link.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.