mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge remote-tracking branch 'upstream/master'
* upstream/master: rebuild pages 更新 gh-pages 中 markdown 链接
This commit is contained in:
commit
524a42644f
21
fis-conf.js
21
fis-conf.js
@ -229,6 +229,27 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
} else if (fis.project.currentMedia() === 'gh-pages') {
|
||||
const ghPages = fis.media('gh-pages');
|
||||
|
||||
ghPages.match('/docs/**.md', {
|
||||
rExt: 'js',
|
||||
parser: [parserMarkdown, function(contents, file) {
|
||||
return contents.replace(/\bhref=\\('|")(.+?)\\\1/g, function(_, quota, link) {
|
||||
if (/\.md($|#)/.test(link)) {
|
||||
let parts = link.split('#');
|
||||
parts[0] = parts[0].replace('.md', '');
|
||||
|
||||
if (parts[0][0] !== '/') {
|
||||
parts[0] = path.resolve(path.dirname(file.subpath), parts[0]);
|
||||
}
|
||||
|
||||
return 'href=\\' + quota + '#' + parts.join('#') + '\\' + quota;
|
||||
}
|
||||
|
||||
return _;
|
||||
});
|
||||
}],
|
||||
isMod: true
|
||||
});
|
||||
|
||||
ghPages.match('/node_modules/(**)', {
|
||||
release: '/n/$1'
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user