File tree Expand file tree Collapse file tree 5 files changed +132
-124
lines changed Expand file tree Collapse file tree 5 files changed +132
-124
lines changed Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ function Site(props) {
269269 ) ,
270270 } ,
271271 { content : '参与贡献' , url : '/contribute/' } ,
272- { content : '投票' , url : '/vote/' } ,
272+ { content : '投票' , url : 'https://webpack.js.org /vote/' } ,
273273 { content : '博客' , url : '/blog/' } ,
274274 { content : '印记中文' , url : 'https://docschina.org' } ,
275275 ] }
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- import toString from 'mdast-util-to-string' ;
3+ import { toString } from 'mdast-util-to-string' ;
44import { visit } from 'unist-util-visit' ;
55import slugs from 'github-slugger' ;
66
Original file line number Diff line number Diff line change @@ -27,7 +27,15 @@ export default function remarkSlug() {
2727 ) ;
2828 let id = props . id ;
2929
30- id = id ? slugs . slug ( String ( id ) , true ) : slugs . slug ( toString ( node ) ) ;
30+ const rawHeader = id ? id : toString ( node ) ;
31+ const match = / ^ .+ ( \s * \$ # ( [ a - z 0 - 9 \- _ ] + ?) \$ \s * ) $ / . exec ( rawHeader ) ;
32+ id = match ? match [ 2 ] : slugs . slug ( rawHeader , true ) ;
33+
34+ if ( match ) {
35+ // Remove the custom ID part from the text node.
36+ const lastNode = node . children [ node . children . length - 1 ] ;
37+ lastNode . value = lastNode . value . replace ( match [ 1 ] , '' ) ;
38+ }
3139
3240 data . id = id ;
3341 props . id = id ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import webpack from 'webpack';
44import h from 'hastscript' ;
55import remarkResponsiveTable from './src/remark-plugins/remark-responsive-table/remark-responsive-table.mjs' ;
66import gfm from 'remark-gfm' ;
7- import slug from './src/remark-plugins/docschina- remark-slugger /index.mjs' ;
7+ import slug from './src/remark-plugins/remark-slug /index.mjs' ;
88import cleanup from './src/remark-plugins/remark-cleanup-readme/index.mjs' ;
99import aside from './src/remark-plugins/remark-custom-asides/index.mjs' ;
1010import autolink from 'remark-autolink-headings' ;
You can’t perform that action at this time.
0 commit comments