File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ markdownDownload(websiteConfigs.juejin, {
4242```
4343
4444## 已支持的网站
45+ [ Github Issue] ( https://github.com/ )
4546[ 掘金] ( https://juejin.cn/ )
4647[ 知乎专栏] ( https://zhuanlan.zhihu.com/ )
4748[ 思否专栏] ( https://segmentfault.com/ )
Original file line number Diff line number Diff line change 1+ require ( 'mathjax/es5/tex-svg' )
2+ const tex2svg = ( markdownDoc ) => {
3+ return markdownDoc . replace ( / < z t e x t > ( .* ?) < \/ z t e x t > / g, ( s , s1 ) => {
4+ const tex = decodeURIComponent ( s1 )
5+ const svg = MathJax . tex2svg ( tex )
6+ svg . setAttribute ( 'data-tex' , tex )
7+ svg . style . display = 'inline'
8+ return svg . outerHTML
9+ } )
10+ }
11+ Object . assign ( module . exports , Object . assign ( exports , {
12+ tex2svg
13+ } ) )
Original file line number Diff line number Diff line change 1+ export const hosts = [ 'github.com' ]
2+
3+ export const options = {
4+ origin : 'github' ,
5+ link : false ,
6+ br : true ,
7+ code : false ,
8+ selectors : {
9+ title : '#partial-discussion-header .markdown-title' ,
10+ body : '.js-quote-selection-container .markdown-body' ,
11+ copyBtn : '.copy-btn' ,
12+ userName : '[data-hovercard-type="user"]' ,
13+ userLink : '[data-hovercard-type="user"]' ,
14+ invalid : '' ,
15+ unpack : '' ,
16+ tag : '.js-issue-labels .IssueLabel'
17+ }
18+ }
19+
20+ export const hook = {
21+ }
22+
23+ export const config = {
24+ hosts,
25+ options,
26+ hook
27+ }
28+
29+ export default config
Original file line number Diff line number Diff line change 1- import { tex2svg } from '../utils'
21export const hosts = [ 'zhuanlan.zhihu.com' ]
32
43export const options = {
@@ -28,6 +27,7 @@ export const hook = {
2827 } )
2928 } ,
3029 formatContent ( context , { markdownDoc } ) {
30+ const { tex2svg } = require ( '../mathjax' )
3131 return tex2svg ( markdownDoc )
3232 }
3333}
You can’t perform that action at this time.
0 commit comments