Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
jupyter-render
提交
0f667900
J
jupyter-render
项目概览
gitcode_dev
/
jupyter-render
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jupyter-render
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0f667900
编写于
9月 24, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:添加全屏按钮
上级
0cab536e
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
5 deletion
+6
-5
dist/assets/index.css
dist/assets/index.css
+1
-1
dist/assets/index.js
dist/assets/index.js
+1
-1
dist/assets/vendor.js
dist/assets/vendor.js
+1
-1
dist/index.html
dist/index.html
+3
-2
未找到文件。
dist/assets/index.css
浏览文件 @
0f667900
此差异已折叠。
点击以展开。
dist/assets/index.js
浏览文件 @
0f667900
import
{
d
as
e
,
l
as
t
,
m
as
n
,
p
as
s
,
a
as
r
,
c
as
l
,
b
as
o
,
e
as
i
,
f
as
a
,
w
as
u
,
T
as
c
,
o
as
d
,
F
as
p
,
_
as
h
,
r
as
g
,
g
as
f
,
h
as
m
,
i
as
v
,
j
as
y
}
from
"
./vendor.js
"
;
!
function
(){
const
e
=
document
.
createElement
(
"
link
"
).
relList
;
if
(
!
(
e
&&
e
.
supports
&&
e
.
supports
(
"
modulepreload
"
))){
for
(
const
e
of
document
.
querySelectorAll
(
'
link[rel="modulepreload"]
'
))
t
(
e
);
new
MutationObserver
((
e
=>
{
for
(
const
n
of
e
)
if
(
"
childList
"
===
n
.
type
)
for
(
const
e
of
n
.
addedNodes
)
"
LINK
"
===
e
.
tagName
&&
"
modulepreload
"
===
e
.
rel
&&
t
(
e
)})).
observe
(
document
,{
childList
:
!
0
,
subtree
:
!
0
})}
function
t
(
e
){
if
(
e
.
ep
)
return
;
e
.
ep
=!
0
;
const
t
=
function
(
e
){
const
t
=
{};
return
e
.
integrity
&&
(
t
.
integrity
=
e
.
integrity
),
e
.
referrerpolicy
&&
(
t
.
referrerPolicy
=
e
.
referrerpolicy
),
"
use-credentials
"
===
e
.
crossorigin
?
t
.
credentials
=
"
include
"
:
"
anonymous
"
===
e
.
crossorigin
?
t
.
credentials
=
"
omit
"
:
t
.
credentials
=
"
same-origin
"
,
t
}(
e
);
fetch
(
e
.
href
,
t
)}}();
var
b
=
e
({
name
:
"
HelloWorld
"
,
props
:{
info
:{
type
:
Object
,
default
:{
cell_type
:
""
,
source
:[],
outputs
:[]}}},
computed
:{
input
(){
const
e
=
this
.
info
,
n
=
(
e
.
input
?
e
.
input
.
join
(
""
):
""
)
+
(
e
.
source
?
e
.
source
.
join
(
""
):
""
);
switch
(
e
.
cell_type
){
case
"
heading
"
:
const
s
=
e
.
level
;
return
`<h
${
s
}
>
${
n
}
</h
${
s
}
>`
;
case
"
markdown
"
:
return
this
.
marked
(
n
);
case
"
code
"
:
return
`<code class="hljs">
${
this
.
generateCodeLineNum
(
n
?
t
.
highlightAuto
(
n
).
value
:
""
)}
</code>`
;
default
:
return
n
}},
output
(){
var
e
;
const
n
=
null
==
(
e
=
this
.
info
.
outputs
)?
void
0
:
e
.
map
((
e
=>
(
e
.
text
?
e
.
text
.
join
(
""
):
""
)
+
(
e
.
png
?
`<img src="data:image/png;base64,
${
e
.
png
}
" />`
:
""
)
+
(
e
.
svg
?
e
.
svg
.
join
(
""
):
""
))).
join
(
""
);
return
n
?
/
[
img|svg
]
/
.
test
(
n
)?
n
:
t
.
highlightAuto
(
n
).
value
:
""
}},
data
:()
=>
({
showResult
:
!
1
,
loading
:
!
1
,
timeObj
:
""
}),
methods
:{
run
(){
this
.
loading
=!
0
,
this
.
showResult
=!
0
;
const
e
=
this
.
loadTime
();
this
.
timeObj
=
setTimeout
((()
=>
{
this
.
loading
=!
1
,
clearTimeout
(
this
.
timeObj
)}),
e
)},
loadTime
:()
=>
Math
.
floor
(
500
*
Math
.
random
()
+
500
),
marked
(
e
){
if
(
!
e
)
return
""
;
n
.
setOptions
({
breaks
:
!
1
,
gfm
:
!
0
,
langPrefix
:
"
hljs language-
"
,
highlight
:
e
=>
this
.
generateCodeLineNum
(
t
.
highlightAuto
(
e
).
value
)});
return
n
(
e
)},
generateCodeLineNum
:
e
=>
e
?
`<ul class="code_line_num"><li>
${
e
.
replace
(
/
\n
/g
,
"
\n
</li><li>
"
)}
\n</li></ul>`
:
""
}});
s
(
"
data-v-57ea04c9
"
);
const
j
=
{
class
:
"
jupyter_input
"
},
k
=
{
key
:
1
,
class
:
"
stop_btn
"
},
_
=
{
class
:
"
jupyter_code
"
},
C
=
[
"
innerHTML
"
],
L
=
{
key
:
0
,
class
:
"
jupyter_output
"
},
w
=
{
key
:
0
,
class
:
"
loading
"
},
T
=
[
"
innerHTML
"
];
r
(),
b
.
render
=
function
(
e
,
t
,
n
,
s
,
r
,
h
){
return
d
(),
l
(
"
div
"
,
null
,[
o
(
"
div
"
,
j
,[
e
.
output
&&!
e
.
loading
?(
d
(),
l
(
"
div
"
,{
key
:
0
,
class
:
"
run_btn
"
,
onClick
:
t
[
0
]
||
(
t
[
0
]
=
(...
t
)
=>
e
.
run
&&
e
.
run
(...
t
))})):
i
(
""
,
!
0
),
e
.
output
&&
e
.
loading
?(
d
(),
l
(
"
div
"
,
k
)):
i
(
""
,
!
0
),
o
(
"
div
"
,
_
,[
o
(
"
pre
"
,
null
,[
o
(
"
p
"
,{
innerHTML
:
e
.
input
},
null
,
8
,
C
)])])]),
a
(
c
,{
name
:
"
fade
"
},{
default
:
u
((()
=>
[
e
.
showResult
?(
d
(),
l
(
"
div
"
,
L
,[
e
.
loading
?(
d
(),
l
(
"
div
"
,
w
)):(
d
(),
l
(
p
,{
key
:
1
},[
o
(
"
div
"
,{
class
:
"
close_btn
"
,
onClick
:
t
[
1
]
||
(
t
[
1
]
=
t
=>
e
.
showResult
=!
1
)}),
o
(
"
div
"
,{
class
:
"
jupyter_result
"
,
innerHTML
:
e
.
output
},
null
,
8
,
T
)],
64
))])):
i
(
""
,
!
0
)])),
_
:
1
})])},
b
.
__scopeId
=
"
data-v-57ea04c9
"
;
var
$
=
(
e
,
t
)
=>
h
.
get
(
e
,{
params
:
t
}),
H
=
e
({
name
:
"
App
"
,
props
:{
url
:{
type
:
String
,
default
:
""
}},
components
:{
Cell
:
b
},
data
:()
=>
({
cells
:[]}),
created
(){
this
.
fetchCells
()},
computed
:{
linkHref
(){
return
this
.
url
.
replace
(
/
\/
blob
\/
/
,
"
/jupyter/
"
)}},
methods
:{
fetchCells
(){
const
e
=
this
.
url
;
if
(
!
e
)
return
;
const
{
groups
:
t
}
=
/
(?<
prex>^https
?
:
\/\/\S
+.net
)\/(?<
project_path>
\S
*
)\/\-\/
blob
\/(?<
branch>
\S
+
?)\/(?<
path>
\S
*
)
/
.
exec
(
e
),
n
=
`
${
t
.
prex
}
/api/v4/projects/
${
encodeURIComponent
(
t
.
project_path
)}
/repository/files/
${
t
.
path
}
/raw?ref=
${
t
.
branch
}
`
;
$
(
n
).
then
((({
data
:
e
})
=>
{
this
.
cells
=
this
.
getCells
(
e
)}))},
getCells
(
e
){
var
t
;
const
n
=
[];
return
e
.
cells
&&
n
.
push
(...
e
.
cells
),
null
==
(
t
=
e
.
worksheets
)
||
t
.
forEach
((
e
=>
{
n
.
push
(...
e
.
cells
)})),
console
.
log
(
n
),
n
}}});
s
(
"
data-v-fbd29500
"
);
const
M
=
{
class
:
"
jupyter_container
"
},
S
=
[
"
href
"
],
x
=
[
v
(
"
点击这里去
"
),
o
(
"
span
"
,
null
,
"
notebook
"
,
-
1
),
v
(
"
中调试该代码
"
)];
r
(),
H
.
render
=
function
(
e
,
t
,
n
,
s
,
r
,
a
){
const
u
=
g
(
"
Cell
"
);
return
d
(),
l
(
"
div
"
,
null
,[
o
(
"
div
"
,
M
,[(
d
(
!
0
),
l
(
p
,
null
,
f
(
e
.
cells
,(
e
=>
(
d
(),
m
(
u
,{
key
:
e
.
id
,
info
:
e
},
null
,
8
,[
"
info
"
])))),
128
))]),
e
.
cells
.
length
?(
d
(),
l
(
"
a
"
,{
key
:
0
,
href
:
e
.
linkHref
,
target
:
"
_blank
"
,
class
:
"
link
"
},
x
,
8
,
S
)):
i
(
""
,
!
0
)])},
H
.
__scopeId
=
"
data-v-fbd29500
"
;
console
.
log
(
"
render jupyter
"
);
const
A
=
Array
.
from
(
document
.
querySelectorAll
(
"
a
"
));
A
.
length
&&
A
.
forEach
((
e
=>
{
const
t
=
e
.
innerHTML
;
if
(
!
t
.
includes
(
"
.ipynb
"
))
return
;
const
n
=
document
.
createElement
(
"
div
"
);
var
s
,
r
;
s
=
n
,(
r
=
e
).
parentNode
.
insertBefore
(
s
,
r
.
nextSibling
),
y
(
H
,{
url
:
t
}).
mount
(
n
)}));
import
{
d
as
e
,
l
as
t
,
m
as
n
,
c
as
l
,
a
as
s
,
b
as
o
,
e
as
r
,
w
as
i
,
T
as
a
,
o
as
c
,
F
as
u
,
_
as
d
,
r
as
p
,
f
as
h
,
n
as
f
,
g
,
h
as
m
,
p
as
v
,
i
as
y
,
j
as
b
}
from
"
./vendor.js
"
;
!
function
(){
const
e
=
document
.
createElement
(
"
link
"
).
relList
;
if
(
!
(
e
&&
e
.
supports
&&
e
.
supports
(
"
modulepreload
"
))){
for
(
const
e
of
document
.
querySelectorAll
(
'
link[rel="modulepreload"]
'
))
t
(
e
);
new
MutationObserver
((
e
=>
{
for
(
const
n
of
e
)
if
(
"
childList
"
===
n
.
type
)
for
(
const
e
of
n
.
addedNodes
)
"
LINK
"
===
e
.
tagName
&&
"
modulepreload
"
===
e
.
rel
&&
t
(
e
)})).
observe
(
document
,{
childList
:
!
0
,
subtree
:
!
0
})}
function
t
(
e
){
if
(
e
.
ep
)
return
;
e
.
ep
=!
0
;
const
t
=
function
(
e
){
const
t
=
{};
return
e
.
integrity
&&
(
t
.
integrity
=
e
.
integrity
),
e
.
referrerpolicy
&&
(
t
.
referrerPolicy
=
e
.
referrerpolicy
),
"
use-credentials
"
===
e
.
crossorigin
?
t
.
credentials
=
"
include
"
:
"
anonymous
"
===
e
.
crossorigin
?
t
.
credentials
=
"
omit
"
:
t
.
credentials
=
"
same-origin
"
,
t
}(
e
);
fetch
(
e
.
href
,
t
)}}();
var
k
=
(
e
,
t
)
=>
{
for
(
const
[
n
,
l
]
of
t
)
e
[
n
]
=
l
;
return
e
};
const
j
=
e
({
name
:
"
HelloWorld
"
,
props
:{
info
:{
type
:
Object
,
default
:{
cell_type
:
""
,
source
:[],
outputs
:[]}}},
computed
:{
input
(){
const
e
=
this
.
info
,
n
=
(
e
.
input
?
e
.
input
.
join
(
""
):
""
)
+
(
e
.
source
?
e
.
source
.
join
(
""
):
""
);
switch
(
e
.
cell_type
){
case
"
heading
"
:
const
l
=
e
.
level
;
return
`<h
${
l
}
>
${
n
}
</h
${
l
}
>`
;
case
"
markdown
"
:
return
this
.
marked
(
n
);
case
"
code
"
:
return
`<code class="hljs">
${
this
.
generateCodeLineNum
(
n
?
t
.
highlightAuto
(
n
).
value
:
""
)}
</code>`
;
default
:
return
n
}},
output
(){
var
e
;
const
n
=
null
==
(
e
=
this
.
info
.
outputs
)?
void
0
:
e
.
map
((
e
=>
(
e
.
text
?
e
.
text
.
join
(
""
):
""
)
+
(
e
.
png
?
`<img src="data:image/png;base64,
${
e
.
png
}
" />`
:
""
)
+
(
e
.
svg
?
e
.
svg
.
join
(
""
):
""
))).
join
(
""
);
return
n
?
/
[
img|svg
]
/
.
test
(
n
)?
n
:
t
.
highlightAuto
(
n
).
value
:
""
}},
data
:()
=>
({
showResult
:
!
1
,
loading
:
!
1
,
timeObj
:
""
}),
methods
:{
run
(){
this
.
loading
=!
0
,
this
.
showResult
=!
0
;
const
e
=
this
.
loadTime
();
this
.
timeObj
=
setTimeout
((()
=>
{
this
.
loading
=!
1
,
clearTimeout
(
this
.
timeObj
)}),
e
)},
loadTime
:()
=>
Math
.
floor
(
500
*
Math
.
random
()
+
500
),
marked
(
e
){
if
(
!
e
)
return
""
;
n
.
setOptions
({
breaks
:
!
1
,
gfm
:
!
0
,
langPrefix
:
"
hljs language-
"
,
highlight
:
e
=>
this
.
generateCodeLineNum
(
t
.
highlightAuto
(
e
).
value
)});
return
n
(
e
)},
generateCodeLineNum
:
e
=>
e
?
`<ul class="code_line_num"><li>
${
e
.
replace
(
/
\n
/g
,
"
\n
</li><li>
"
)}
\n</li></ul>`
:
""
}}),
_
=
{
class
:
"
jupyter_input
"
},
S
=
{
key
:
1
,
class
:
"
stop_btn
"
},
C
=
{
class
:
"
jupyter_code
"
},
L
=
[
"
innerHTML
"
],
w
=
{
key
:
0
,
class
:
"
jupyter_output
"
},
$
=
{
key
:
0
,
class
:
"
loading
"
},
T
=
[
"
innerHTML
"
];
const
M
=
e
({
name
:
"
App
"
,
props
:{
url
:{
type
:
String
,
default
:
""
}},
components
:{
Cell
:
k
(
j
,[[
"
render
"
,
function
(
e
,
t
,
n
,
d
,
p
,
h
){
return
c
(),
l
(
"
div
"
,
null
,[
s
(
"
div
"
,
_
,[
e
.
output
&&!
e
.
loading
?(
c
(),
l
(
"
div
"
,{
key
:
0
,
class
:
"
run_btn
"
,
onClick
:
t
[
0
]
||
(
t
[
0
]
=
(...
t
)
=>
e
.
run
&&
e
.
run
(...
t
))})):
o
(
""
,
!
0
),
e
.
output
&&
e
.
loading
?(
c
(),
l
(
"
div
"
,
S
)):
o
(
""
,
!
0
),
s
(
"
div
"
,
C
,[
s
(
"
pre
"
,
null
,[
s
(
"
p
"
,{
innerHTML
:
e
.
input
},
null
,
8
,
L
)])])]),
r
(
a
,{
name
:
"
fade
"
},{
default
:
i
((()
=>
[
e
.
showResult
?(
c
(),
l
(
"
div
"
,
w
,[
e
.
loading
?(
c
(),
l
(
"
div
"
,
$
)):(
c
(),
l
(
u
,{
key
:
1
},[
s
(
"
div
"
,{
class
:
"
close_btn
"
,
onClick
:
t
[
1
]
||
(
t
[
1
]
=
t
=>
e
.
showResult
=!
1
)}),
s
(
"
div
"
,{
class
:
"
jupyter_result
"
,
innerHTML
:
e
.
output
},
null
,
8
,
T
)],
64
))])):
o
(
""
,
!
0
)])),
_
:
1
})])}],[
"
__scopeId
"
,
"
data-v-57ea04c9
"
]])},
data
:()
=>
({
cells
:[],
fullScreen
:
!
1
}),
created
(){
this
.
fetchCells
()},
computed
:{
linkHref
(){
return
this
.
url
.
replace
(
/
\/
blob
\/
/
,
"
/jupyter/
"
)}},
methods
:{
fetchCells
(){
const
e
=
this
.
url
;
if
(
!
e
)
return
;
const
{
groups
:
t
}
=
/
(?<
prex>^https
?
:
\/\/\S
+.net
)\/(?<
project_path>
\S
*
)\/\-\/
blob
\/(?<
branch>
\S
+
?)\/(?<
path>
\S
*
)
/
.
exec
(
e
),
n
=
`
${
t
.
prex
}
/api/v4/projects/
${
encodeURIComponent
(
t
.
project_path
)}
/repository/files/
${
t
.
path
}
/raw?ref=
${
t
.
branch
}
`
;
d
.
get
(
n
).
then
((({
data
:
e
})
=>
{
this
.
cells
=
this
.
getCells
(
e
),
console
.
log
(
111
,
e
),
console
.
log
(
222
,
this
.
cells
)}))},
getCells
(
e
){
var
t
;
const
n
=
[];
return
e
.
cells
&&
n
.
push
(...
e
.
cells
),
null
==
(
t
=
e
.
worksheets
)
||
t
.
forEach
((
e
=>
{
n
.
push
(...
e
.
cells
)})),
console
.
log
(
3333
,
n
),
n
}}}),
N
=
e
=>
(
v
(
"
data-v-0054616b
"
),
e
=
e
(),
y
(),
e
),
x
=
[
"
href
"
],
A
=
[
m
(
"
点击这里去
"
),
N
((()
=>
s
(
"
span
"
,
null
,
"
notebook
"
,
-
1
))),
m
(
"
中调试该代码
"
)];
var
H
=
k
(
M
,[[
"
render
"
,
function
(
e
,
t
,
n
,
r
,
i
,
a
){
const
d
=
p
(
"
Cell
"
);
return
c
(),
l
(
"
div
"
,{
class
:
f
([
"
relative
"
,{
fullScreen
:
e
.
fullScreen
}])},[
s
(
"
div
"
,{
class
:
f
([
"
jupyter_container
"
,{
fullScreen
:
e
.
fullScreen
}])},[(
c
(
!
0
),
l
(
u
,
null
,
h
(
e
.
cells
,(
e
=>
(
c
(),
g
(
d
,{
key
:
e
.
id
,
info
:
e
},
null
,
8
,[
"
info
"
])))),
128
))],
2
),
e
.
fullScreen
?(
c
(),
l
(
"
button
"
,{
key
:
0
,
onClick
:
t
[
0
]
||
(
t
[
0
]
=
t
=>
e
.
fullScreen
=!
1
),
class
:
"
copyButton
"
},
"
退出全屏
"
)):(
c
(),
l
(
"
button
"
,{
key
:
1
,
onClick
:
t
[
1
]
||
(
t
[
1
]
=
t
=>
e
.
fullScreen
=!
0
),
class
:
"
copyButton
"
},
"
全屏显示
"
)),
e
.
cells
.
length
?(
c
(),
l
(
"
a
"
,{
key
:
2
,
href
:
e
.
linkHref
,
target
:
"
_blank
"
,
class
:
"
link
"
},
A
,
8
,
x
)):
o
(
""
,
!
0
)],
2
)}],[
"
__scopeId
"
,
"
data-v-0054616b
"
]]);
document
.
addEventListener
(
"
DOMContentLoaded
"
,(()
=>
{
const
e
=
Array
.
from
(
document
.
querySelectorAll
(
"
a
"
));
e
.
length
&&
e
.
forEach
((
e
=>
{
const
t
=
e
.
href
;
if
(
!
(
null
==
t
?
void
0
:
t
.
includes
(
"
.ipynb
"
))
||!
e
.
className
.
includes
(
"
jupyterEl
"
))
return
;
const
n
=
document
.
createElement
(
"
div
"
);
var
l
,
s
;
l
=
n
,(
s
=
e
).
parentNode
.
insertBefore
(
l
,
s
.
nextSibling
),
b
(
H
,{
url
:
t
}).
mount
(
n
)})
)}));
dist/assets/vendor.js
浏览文件 @
0f667900
此差异已折叠。
点击以展开。
dist/index.html
浏览文件 @
0f667900
...
...
@@ -21,8 +21,9 @@
<div class="app"></div> -->
<a
data-type=
"jupyter"
data-url=
"http://test-code.csdn.net/cpongo6/ipynb-test/-/blob/master/Cell%20Magics.ipynb"
>
http://test-code.csdn.net/cpongo6/ipynb-test/-/blob/master/Cell%20Magics.ipynb
</a
class=
"jupyterEl"
href=
"https://codechina.csdn.net/xiongjiamu/jupyter-101/-/blob/master/002-demo.ipynb"
>
https://codechina.csdn.net/xiongjiamu/jupyter-101/-/blob/master/002-demo.ipynb
</a
>
<!-- <div
data-type="jupyter"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录