File tree 4 files changed +41
-0
lines changed
client/themes/default/scss
server/modules/rendering/markdown-core
4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 3
3
.contents {
4
4
color : mc (' grey' , ' 800' );
5
5
6
+ h1 , h2 , h3 , h4 , h5 , h6 {
7
+ position : relative ;
8
+
9
+ & :hover {
10
+ .toc-anchor {
11
+ display : block ;
12
+ }
13
+ }
14
+
15
+ .toc-anchor {
16
+ display : none ;
17
+ position : absolute ;
18
+ right : 1rem ;
19
+ bottom : .5rem ;
20
+ font-size : 1.25rem ;
21
+ text-decoration : none ;
22
+ color : mc (' grey' , ' 500' );
23
+ }
24
+ }
25
+
6
26
h1 {
7
27
padding-left : 24px ;
8
28
color : mc (' blue' , ' 800' );
Original file line number Diff line number Diff line change 147
147
"semver" : " 5.5.1" ,
148
148
"serve-favicon" : " 2.5.0" ,
149
149
"sqlite3" : " 4.0.2" ,
150
+ "uslug" : " 1.0.4" ,
150
151
"uuid" : " 3.3.2" ,
151
152
"validator" : " 10.7.1" ,
152
153
"validator-as-promised" : " 1.0.2" ,
Original file line number Diff line number Diff line change 1
1
const md = require ( 'markdown-it' )
2
+ const mdAnchor = require ( 'markdown-it-anchor' )
2
3
const _ = require ( 'lodash' )
4
+ const uslug = require ( 'uslug' )
3
5
4
6
const quoteStyles = {
5
7
Chinese : '””‘’' ,
@@ -29,6 +31,14 @@ module.exports = {
29
31
}
30
32
} )
31
33
34
+ mkdown . use ( mdAnchor , {
35
+ slugify : s => uslug ( s ) ,
36
+ permalink : true ,
37
+ permalinkClass : 'toc-anchor' ,
38
+ permalinkSymbol : '¶' ,
39
+ permalinkBefore : true
40
+ } )
41
+
32
42
for ( let child of this . children ) {
33
43
const renderer = require ( `../${ _ . kebabCase ( child . key ) } /renderer.js` )
34
44
renderer . init ( mkdown , child . config )
Original file line number Diff line number Diff line change @@ -12085,6 +12085,10 @@ universalify@^0.1.0:
12085
12085
version "0.1.1"
12086
12086
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
12087
12087
12088
+ " unorm@>= 1.0.0 " :
12089
+ version "1.4.1"
12090
+ resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.4.1.tgz#364200d5f13646ca8bcd44490271335614792300"
12091
+
12088
12092
12089
12093
version "1.0.0"
12090
12094
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
@@ -12172,6 +12176,12 @@ use@^3.1.0:
12172
12176
dependencies :
12173
12177
kind-of "^6.0.2"
12174
12178
12179
+
12180
+ version "1.0.4"
12181
+ resolved "https://registry.yarnpkg.com/uslug/-/uslug-1.0.4.tgz#b9a22f0914e0a86140633dacc302e5f4fa450677"
12182
+ dependencies :
12183
+ unorm ">= 1.0.0"
12184
+
12175
12185
util-deprecate@~1.0.1 :
12176
12186
version "1.0.2"
12177
12187
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
You can’t perform that action at this time.
0 commit comments