File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
templates/default/introduce/guides Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,20 @@ sort: 7
38
38
39
39
## 内嵌代码编辑器支持
40
40
41
- 目前编辑器支持 [ codepen.io] ( https://codepen.io/ ) 、[ jsfiddle.net] ( https://jsfiddle.net/ ) 、[ runjs.cn] ( http://runjs.cn ) 三个网站,其中 runjs.cn 因为不是 ` https ` 站点,当你的 rdoc 生成的网站是 ` https ` 浏览器会屏蔽 http 的 runjs.cn 站点嵌入 。
41
+ 目前编辑器支持 [ codepen.io] ( https://codepen.io/ ) 、[ jsfiddle.net] ( https://jsfiddle.net/ ) 、[ runjs.cn] ( http://runjs.cn ) 三个网站。
42
42
43
43
### 编辑器 codepen.io 展示效果
44
44
45
45
直接将网址 ` https://codepen.io/jaywcjlove/pen/ZWJVKy ` 贴入 Markdown 中,出如下预览效果。
46
46
47
47
https://codepen.io/jaywcjlove/pen/ZWJVKy
48
48
49
+ ### 编辑器 codesandbox.io 展示效果
50
+
51
+ 直接将网址 ` https://codesandbox.io/s/jlomy0xoo5 ` 贴入 Markdown 中,出如下预览效果。
52
+
53
+ https://codesandbox.io/embed/jlomy0xoo5
54
+
49
55
### 编辑器 jsfiddle.net 展示效果
50
56
51
57
直接将网址 ` https://jsfiddle.net/jaywcjlove/sxx57x6m/ ` 贴入 Markdown 中,出如下预览效果。
@@ -56,5 +62,7 @@ https://jsfiddle.net/jaywcjlove/sxx57x6m/
56
62
57
63
直接将网址 ` http://runjs.cn/code/yzfkxts2 ` 贴入 Markdown 中,出如下预览效果。
58
64
65
+ > runjs.cn 因为不是 ` https ` 站点,当你的 rdoc 生成的网站如果是 ` https ` 站点,浏览器会屏蔽 http 的 runjs.cn 站点嵌入
66
+
59
67
http://runjs.cn/code/yzfkxts2
60
68
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export default class Header extends PureComponent {
28
28
const url = item . mdconf && ( item . mdconf . github || item . mdconf . url ) ;
29
29
if ( url ) {
30
30
return (
31
- < a key = { index } target = "_blank" href = { url } >
31
+ < a key = { index } target = "_blank" rel = "noopener noreferrer" href = { url } >
32
32
{ item . mdconf . github && SVGGithub } { item . mdconf . title && < span > { item . mdconf . title } </ span > }
33
33
</ a >
34
34
) ;
Original file line number Diff line number Diff line change @@ -4,17 +4,21 @@ import styles from './Link.less';
4
4
export default ( { title, href, children } ) => {
5
5
let link = href . replace ( / ( \/ | \/ s h o w \/ | \/ s h o w ) $ / g, '' ) ;
6
6
if (
7
- / ^ ( h t t p (?: | s ) : ) \/ \/ ( j s f i d d l e .n e t | r u n j s .c n | c o d e p e n .i o ) / . test ( link ) &&
8
- ! / ^ ( h t t p s | h t t p ) : \/ \/ ( j s f i d d l e .n e t | r u n j s .c n | c o d e p e n .i o ) (?: | \/ ) $ / . test ( link )
7
+ / ^ ( h t t p (?: | s ) : ) \/ \/ ( j s f i d d l e .n e t | r u n j s .c n | c o d e p e n .i o | c o d e s a n d b o x . i o ) / . test ( link ) &&
8
+ ! / ^ ( h t t p s | h t t p ) : \/ \/ ( j s f i d d l e .n e t | r u n j s .c n | c o d e p e n .i o | c o d e s a n d b o x . i o ) (?: | \/ ) $ / . test ( link )
9
9
) {
10
10
const regexRunjs = / ( h t t p s | h t t p ) : \/ \/ r u n j s .c n \/ c o d e \/ ( .* ) / gi;
11
11
const regexCodepen = / ( h t t p s | h t t p ) : \/ \/ c o d e p e n .i o \/ ( .* ) \/ p e n \/ ( .* ) / gi;
12
+ const regexCodesandbox = / ( h t t p s | h t t p ) : \/ \/ c o d e s a n d b o x .i o \/ ( s | e m b e d ) \/ ( .* ) / gi;
12
13
const runjs = regexRunjs . exec ( link ) ;
13
14
const codepen = regexCodepen . exec ( link ) ;
15
+ const codesandbox = regexCodesandbox . exec ( link ) ;
14
16
if ( runjs && runjs . length > 2 ) {
15
17
link = `http://sandbox.runjs.cn/show/${ runjs [ 2 ] } ` ;
16
18
} else if ( codepen && codepen . length === 4 ) {
17
19
link = `https://codepen.io/${ codepen [ 2 ] } /embed/${ codepen [ 3 ] } ?height=400` ;
20
+ } else if ( codesandbox && codesandbox . length === 4 ) {
21
+ link = `https://codesandbox.io/embed/${ codesandbox [ 3 ] } ` ;
18
22
} else {
19
23
link = `${ link } /show/` ;
20
24
}
You can’t perform that action at this time.
0 commit comments