Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计算机应用开发
前端
Vuepress
提交
14d4d258
V
Vuepress
项目概览
计算机应用开发
/
前端
/
Vuepress
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vuepress
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
14d4d258
编写于
4月 17, 2018
作者:
E
Evan You
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: ensure using the same markdown config when extracting headers
上级
24a8fe59
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
9 deletion
+14
-9
lib/prepare.js
lib/prepare.js
+10
-4
lib/util/index.js
lib/util/index.js
+1
-2
lib/webpack/createBaseConfig.js
lib/webpack/createBaseConfig.js
+2
-2
lib/webpack/markdownLoader.js
lib/webpack/markdownLoader.js
+1
-1
未找到文件。
lib/prepare.js
浏览文件 @
14d4d258
const
fs
=
require
(
'
fs-extra
'
)
const
path
=
require
(
'
path
'
)
const
path
=
require
(
'
path
'
)
const
fs
=
require
(
'
fs-extra
'
)
const
globby
=
require
(
'
globby
'
)
const
globby
=
require
(
'
globby
'
)
const
yaml
=
require
(
'
yaml-front-matter
'
)
const
yamlParser
=
require
(
'
js-yaml
'
)
const
yamlParser
=
require
(
'
js-yaml
'
)
const
yaml
=
require
(
'
yaml-front-matter
'
)
const
createMarkdown
=
require
(
'
./markdown
'
)
const
tempPath
=
path
.
resolve
(
__dirname
,
'
app/.temp
'
)
const
tempPath
=
path
.
resolve
(
__dirname
,
'
app/.temp
'
)
const
{
inferTitle
,
extractHeaders
}
=
require
(
'
./util
'
)
const
{
inferTitle
,
extractHeaders
}
=
require
(
'
./util
'
)
...
@@ -120,7 +121,8 @@ async function resolveOptions (sourceDir) {
...
@@ -120,7 +121,8 @@ async function resolveOptions (sourceDir) {
pagesData
:
null
,
pagesData
:
null
,
themePath
:
null
,
themePath
:
null
,
notFoundPath
:
null
,
notFoundPath
:
null
,
useDefaultTheme
useDefaultTheme
,
markdown
:
createMarkdown
(
siteConfig
)
}
}
if
(
useDefaultTheme
)
{
if
(
useDefaultTheme
)
{
...
@@ -171,7 +173,11 @@ async function resolveOptions (sourceDir) {
...
@@ -171,7 +173,11 @@ async function resolveOptions (sourceDir) {
if
(
title
)
{
if
(
title
)
{
data
.
title
=
title
data
.
title
=
title
}
}
const
headers
=
extractHeaders
(
frontmatter
.
__content
,
[
'
h2
'
,
'
h3
'
])
const
headers
=
extractHeaders
(
frontmatter
.
__content
,
[
'
h2
'
,
'
h3
'
],
options
.
markdown
)
if
(
headers
.
length
)
{
if
(
headers
.
length
)
{
data
.
headers
=
headers
data
.
headers
=
headers
}
}
...
...
lib/util/index.js
浏览文件 @
14d4d258
...
@@ -45,9 +45,8 @@ exports.parseFrontmatter = content => {
...
@@ -45,9 +45,8 @@ exports.parseFrontmatter = content => {
const
LRU
=
require
(
'
lru-cache
'
)
const
LRU
=
require
(
'
lru-cache
'
)
const
cache
=
LRU
({
max
:
1000
})
const
cache
=
LRU
({
max
:
1000
})
const
md
=
require
(
'
../markdown
'
)()
exports
.
extractHeaders
=
(
content
,
include
=
[])
=>
{
exports
.
extractHeaders
=
(
content
,
include
=
[]
,
md
)
=>
{
const
key
=
content
+
include
.
join
(
'
,
'
)
const
key
=
content
+
include
.
join
(
'
,
'
)
const
hit
=
cache
.
get
(
key
)
const
hit
=
cache
.
get
(
key
)
if
(
hit
)
{
if
(
hit
)
{
...
...
lib/webpack/createBaseConfig.js
浏览文件 @
14d4d258
...
@@ -6,9 +6,9 @@ module.exports = function createBaseConfig ({
...
@@ -6,9 +6,9 @@ module.exports = function createBaseConfig ({
outDir
,
outDir
,
publicPath
,
publicPath
,
themePath
,
themePath
,
notFoundPath
notFoundPath
,
markdown
},
{
debug
}
=
{},
isServer
)
{
},
{
debug
}
=
{},
isServer
)
{
const
markdown
=
require
(
'
../markdown
'
)(
siteConfig
)
const
Config
=
require
(
'
webpack-chain
'
)
const
Config
=
require
(
'
webpack-chain
'
)
const
{
VueLoaderPlugin
}
=
require
(
'
vue-loader
'
)
const
{
VueLoaderPlugin
}
=
require
(
'
vue-loader
'
)
const
CSSExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
)
const
CSSExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
)
...
...
lib/webpack/markdownLoader.js
浏览文件 @
14d4d258
...
@@ -30,7 +30,7 @@ module.exports = function (src) {
...
@@ -30,7 +30,7 @@ module.exports = function (src) {
if
(
!
isProd
&&
!
isServer
)
{
if
(
!
isProd
&&
!
isServer
)
{
const
inferredTitle
=
inferTitle
(
frontmatter
)
const
inferredTitle
=
inferTitle
(
frontmatter
)
const
headers
=
extractHeaders
(
content
,
[
'
h2
'
,
'
h3
'
])
const
headers
=
extractHeaders
(
content
,
[
'
h2
'
,
'
h3
'
]
,
markdown
)
delete
frontmatter
.
__content
delete
frontmatter
.
__content
// diff frontmatter and title, since they are not going to be part of the
// diff frontmatter and title, since they are not going to be part of the
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录