Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
6c2d8f35
Commit
6c2d8f35
authored
Jan 25, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Statisfy eslint
parent
21755ac9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
app/assets/javascripts/copy_as_gfm.js.es6
app/assets/javascripts/copy_as_gfm.js.es6
+12
-12
No files found.
app/assets/javascripts/copy_as_gfm.js.es6
View file @
6c2d8f35
...
...
@@ -3,7 +3,6 @@
/*= require lib/utils/common_utils */
(() => {
const gfmRules = {
// The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert
...
...
@@ -96,11 +95,11 @@
let lines = text.trim().split('\n');
// Add two spaces to the front of subsequent list items lines,
// or leave the line entirely blank.
lines = lines.map((
s
) => {
s = s
.trim();
if (
s
.length === 0) return '';
lines = lines.map((
l
) => {
const line = l
.trim();
if (
line
.length === 0) return '';
return ` ${
s
}`;
return ` ${
line
}`;
});
return `<dl>\n${lines.join('\n')}\n</dl>`;
...
...
@@ -111,20 +110,21 @@
},
},
SyntaxHighlightFilter: {
'pre.code.highlight'(el, text) {
'pre.code.highlight'(el, t) {
const text = t.trim();
let lang = el.getAttribute('lang');
if (lang === 'plaintext') {
lang = '';
}
text = text.trim();
// Prefixes lines with 4 spaces if the code contains triple backticks
if (lang === '' && text.match(/^```/gm)) {
return text.split('\n').map((
s
) => {
s = s
.trim();
if (
s
.length === 0) return '';
return text.split('\n').map((
l
) => {
const line = l
.trim();
if (
line
.length === 0) return '';
return ` ${
s
}`;
return ` ${
line
}`;
}).join('\n');
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment