Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
78b2fb5d
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
78b2fb5d
编写于
1月 27, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add highlight.js support to markdown, snippets etc
Signed-off-by:
N
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
上级
ffee5bb0
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
93 addition
and
86 deletion
+93
-86
app/assets/stylesheets/application.scss
app/assets/stylesheets/application.scss
+1
-0
app/assets/stylesheets/generic/files.scss
app/assets/stylesheets/generic/files.scss
+0
-62
app/assets/stylesheets/generic/highlight.scss
app/assets/stylesheets/generic/highlight.scss
+61
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+8
-2
app/views/projects/blob/_text.html.haml
app/views/projects/blob/_text.html.haml
+1
-11
app/views/projects/snippets/_blob.html.haml
app/views/projects/snippets/_blob.html.haml
+1
-2
app/views/shared/_file_hljs.html.haml
app/views/shared/_file_hljs.html.haml
+11
-0
app/views/snippets/_blob.html.haml
app/views/snippets/_blob.html.haml
+1
-2
doc/raketasks/user_management.md
doc/raketasks/user_management.md
+2
-2
lib/redcarpet/render/gitlab_html.rb
lib/redcarpet/render/gitlab_html.rb
+7
-5
未找到文件。
app/assets/stylesheets/application.scss
浏览文件 @
78b2fb5d
...
...
@@ -39,6 +39,7 @@
@import
"generic/lists.scss"
;
@import
"generic/forms.scss"
;
@import
"generic/selects.scss"
;
@import
"generic/highlight.scss"
;
/**
* Page specific styles (issues, projects etc):
...
...
app/assets/stylesheets/generic/files.scss
浏览文件 @
78b2fb5d
...
...
@@ -143,68 +143,6 @@
*/
&
.code
{
padding
:
0
;
.highlighted-data
{
border
:
none
;
box-shadow
:
none
;
margin
:
0px
;
padding
:
0px
;
table-layout
:
fixed
;
pre
{
border
:
none
;
border-radius
:
0
;
font-family
:
$monospace_font
;
font-size
:
12px
!
important
;
line-height
:
16px
!
important
;
margin
:
0
;
code
{
white-space
:
pre
;
word-wrap
:
normal
;
}
}
.hljs
{
padding
:
0
;
}
.line-numbers
{
padding
:
10px
;
text-align
:
right
;
float
:
left
;
width
:
60px
;
a
{
font-family
:
$monospace_font
;
display
:
block
;
font-size
:
12px
!
important
;
line-height
:
16px
!
important
;
i
{
display
:
none
;
}
&
:hover
i
{
display
:
inline
;
}
}
}
.highlight
{
overflow
:
auto
;
overflow-y
:
hidden
;
pre
{
white-space
:
pre
;
word-wrap
:
normal
;
.line
{
padding
:
0
10px
;
}
}
}
}
}
}
}
...
...
app/assets/stylesheets/generic/highlight.scss
0 → 100644
浏览文件 @
78b2fb5d
.highlighted-data
{
border
:
none
;
box-shadow
:
none
;
margin
:
0px
;
padding
:
0px
;
table-layout
:
fixed
;
pre
{
border
:
none
;
border-radius
:
0
;
font-family
:
$monospace_font
;
font-size
:
12px
!
important
;
line-height
:
16px
!
important
;
margin
:
0
;
code
{
white-space
:
pre
;
word-wrap
:
normal
;
}
}
.hljs
{
padding
:
0
;
}
.line-numbers
{
padding
:
10px
;
text-align
:
right
;
float
:
left
;
width
:
60px
;
a
{
font-family
:
$monospace_font
;
display
:
block
;
font-size
:
12px
!
important
;
line-height
:
16px
!
important
;
i
{
display
:
none
;
}
&
:hover
i
{
display
:
inline
;
}
}
}
.highlight
{
overflow
:
auto
;
overflow-y
:
hidden
;
pre
{
white-space
:
pre
;
word-wrap
:
normal
;
.line
{
padding
:
0
10px
;
}
}
}
}
app/helpers/application_helper.rb
浏览文件 @
78b2fb5d
...
...
@@ -203,8 +203,14 @@ module ApplicationHelper
def
highlight_js
(
&
block
)
string
=
capture
(
&
block
)
content_tag
:div
,
class:
user_color_scheme_class
do
Pygments
::
Lexer
[
:js
].
highlight
(
string
).
html_safe
content_tag
:div
,
class:
"highlighted-data
#{
user_color_scheme_class
}
"
do
content_tag
:div
,
class:
'highlight'
do
content_tag
:pre
do
content_tag
:code
do
string
.
html_safe
end
end
end
end
end
...
...
app/views/projects/blob/_text.html.haml
浏览文件 @
78b2fb5d
...
...
@@ -8,16 +8,6 @@
-
else
.file-content.code
-
unless
blob
.
empty?
%div
.highlighted-data
{
class:
user_color_scheme_class
}
.line-numbers
-
blob
.
data
.
lines
.
size
.
times
do
|
index
|
-
i
=
index
+
1
=
link_to
"#L
#{
i
}
"
,
id:
"L
#{
i
}
"
,
rel:
"#L
#{
i
}
"
do
%i
.icon-link
=
i
.highlight
%pre
%code
=
raw
blob
.
data
=
render
'shared/file_hljs'
,
blob:
blob
-
else
%p
.nothing_here_message
Empty file
app/views/projects/snippets/_blob.html.haml
浏览文件 @
78b2fb5d
...
...
@@ -9,7 +9,6 @@
=
link_to
"raw"
,
raw_project_snippet_path
(
@project
,
@snippet
),
class:
"btn btn-tiny"
,
target:
"_blank"
.file-content.code
-
unless
@snippet
.
content
.
empty?
%div
{
class:
user_color_scheme_class
}
=
raw
@snippet
.
colorize
(
formatter: :gitlab
)
=
render
'shared/file_hljs'
,
blob:
@snippet
-
else
%p
.nothing_here_message
Empty file
app/views/shared/_file_hljs.html.haml
0 → 100644
浏览文件 @
78b2fb5d
%div
.highlighted-data
{
class:
user_color_scheme_class
}
.line-numbers
-
blob
.
data
.
lines
.
size
.
times
do
|
index
|
-
i
=
index
+
1
=
link_to
"#L
#{
i
}
"
,
id:
"L
#{
i
}
"
,
rel:
"#L
#{
i
}
"
do
%i
.icon-link
=
i
.highlight
%pre
%code
=
raw
blob
.
data
app/views/snippets/_blob.html.haml
浏览文件 @
78b2fb5d
...
...
@@ -18,8 +18,7 @@
=
render_markup
(
@snippet
.
file_name
,
@snippet
.
data
)
-
else
.file-content.code
%div
{
class:
user_color_scheme_class
}
=
raw
@snippet
.
colorize
(
formatter: :gitlab
)
=
render
'shared/file_hljs'
,
blob:
@snippet
-
else
.file-content.code
%p
.nothing_here_message
Empty file
doc/raketasks/user_management.md
浏览文件 @
78b2fb5d
### Add user as a developer to all projects
```
```
bash
bundle
exec
rake gitlab:import:user_to_projects[username@domain.tld]
```
...
...
@@ -11,6 +11,6 @@ Notes:
*
admin users are added as masters
```
```
bash
bundle
exec
rake gitlab:import:all_users_to_all_projects
```
lib/redcarpet/render/gitlab_html.rb
浏览文件 @
78b2fb5d
...
...
@@ -12,10 +12,6 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
end
def
block_code
(
code
,
language
)
options
=
{
options:
{
encoding:
'utf-8'
}
}
lexer
=
Pygments
::
Lexer
.
find
(
language
)
# language can be an alias
options
.
merge!
(
lexer:
lexer
.
aliases
[
0
].
downcase
)
if
lexer
# downcase is required
# New lines are placed to fix an rendering issue
# with code wrapped inside <h1> tag for next case:
#
...
...
@@ -25,7 +21,13 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
#
<<-
HTML
<div class="
#{
h
.
user_color_scheme_class
}
">
#{
Pygments
.
highlight
(
code
,
options
)
}
</div>
<div class="highlighted-data
#{
h
.
user_color_scheme_class
}
">
<div class="highlight">
<pre>
<code class="
#{
language
}
">
#{
code
}
</code>
</pre>
</div>
</div>
HTML
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录