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
c1708514
Commit
c1708514
authored
Mar 19, 2018
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move render_gfm into behaviors directory
parent
956bd6a4
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
20 additions
and
22 deletions
+20
-22
app/assets/javascripts/behaviors/index.js
app/assets/javascripts/behaviors/index.js
+2
-1
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
+2
-2
app/assets/javascripts/behaviors/markdown/render_gfm.js
app/assets/javascripts/behaviors/markdown/render_gfm.js
+1
-1
app/assets/javascripts/behaviors/markdown/render_math.js
app/assets/javascripts/behaviors/markdown/render_math.js
+2
-2
app/assets/javascripts/behaviors/markdown/render_mermaid.js
app/assets/javascripts/behaviors/markdown/render_mermaid.js
+3
-3
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/assets/javascripts/shortcuts_issuable.js
app/assets/javascripts/shortcuts_issuable.js
+1
-1
lib/banzai/pipeline/gfm_pipeline.rb
lib/banzai/pipeline/gfm_pipeline.rb
+2
-2
spec/features/markdown/copy_as_gfm_spec.rb
spec/features/markdown/copy_as_gfm_spec.rb
+1
-1
spec/javascripts/behaviors/copy_as_gfm_spec.js
spec/javascripts/behaviors/copy_as_gfm_spec.js
+1
-1
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+1
-2
spec/javascripts/merge_request_notes_spec.js
spec/javascripts/merge_request_notes_spec.js
+1
-2
spec/javascripts/notes/components/note_app_spec.js
spec/javascripts/notes/components/note_app_spec.js
+1
-1
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+1
-1
spec/javascripts/shortcuts_issuable_spec.js
spec/javascripts/shortcuts_issuable_spec.js
+1
-1
No files found.
app/assets/javascripts/behaviors/index.js
View file @
c1708514
import
'
./autosize
'
;
import
'
./bind_in_out
'
;
import
initCopyAsGFM
from
'
./copy_as_gfm
'
;
import
'
./markdown/render_gfm
'
;
import
initCopyAsGFM
from
'
./markdown/copy_as_gfm
'
;
import
initCopyToClipboard
from
'
./copy_to_clipboard
'
;
import
'
./details_behavior
'
;
import
installGlEmojiElement
from
'
./gl_emoji
'
;
...
...
app/assets/javascripts/behaviors/copy_as_gfm.js
→
app/assets/javascripts/behaviors/
markdown/
copy_as_gfm.js
View file @
c1708514
...
...
@@ -2,8 +2,8 @@
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
{
insertText
,
getSelectedFragment
,
nodeMatchesSelector
}
from
'
..
/lib/utils/common_utils
'
;
import
{
placeholderImage
}
from
'
..
/lazy_loader
'
;
import
{
insertText
,
getSelectedFragment
,
nodeMatchesSelector
}
from
'
~
/lib/utils/common_utils
'
;
import
{
placeholderImage
}
from
'
~
/lazy_loader
'
;
const
gfmRules
=
{
// The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert
...
...
app/assets/javascripts/render_gfm.js
→
app/assets/javascripts/
behaviors/markdown/
render_gfm.js
View file @
c1708514
import
$
from
'
jquery
'
;
import
syntaxHighlight
from
'
~/syntax_highlight
'
;
import
renderMath
from
'
./render_math
'
;
import
renderMermaid
from
'
./render_mermaid
'
;
import
syntaxHighlight
from
'
./syntax_highlight
'
;
// Render Gitlab flavoured Markdown
//
...
...
app/assets/javascripts/render_math.js
→
app/assets/javascripts/
behaviors/markdown/
render_math.js
View file @
c1708514
import
$
from
'
jquery
'
;
import
{
__
}
from
'
.
/locale
'
;
import
flash
from
'
.
/flash
'
;
import
{
__
}
from
'
~
/locale
'
;
import
flash
from
'
~
/flash
'
;
// Renders math using KaTeX in any element with the
// `js-render-math` class
...
...
app/assets/javascripts/render_mermaid.js
→
app/assets/javascripts/
behaviors/markdown/
render_mermaid.js
View file @
c1708514
import
flash
from
'
~/flash
'
;
// Renders diagrams and flowcharts from text using Mermaid in any element with the
// `js-render-mermaid` class.
//
...
...
@@ -12,8 +14,6 @@
// </pre>
//
import
Flash
from
'
./flash
'
;
export
default
function
renderMermaid
(
$els
)
{
if
(
!
$els
.
length
)
return
;
...
...
@@ -52,6 +52,6 @@ export default function renderMermaid($els) {
});
});
}).
catch
((
err
)
=>
{
F
lash
(
`Can't load mermaid module:
${
err
}
`
);
f
lash
(
`Can't load mermaid module:
${
err
}
`
);
});
}
app/assets/javascripts/main.js
View file @
c1708514
...
...
@@ -32,7 +32,6 @@ import LazyLoader from './lazy_loader';
import
initLogoAnimation
from
'
./logo
'
;
import
'
./milestone_select
'
;
import
'
./projects_dropdown
'
;
import
'
./render_gfm
'
;
import
initBreadcrumbs
from
'
./breadcrumb
'
;
import
initDispatcher
from
'
./dispatcher
'
;
...
...
app/assets/javascripts/shortcuts_issuable.js
View file @
c1708514
...
...
@@ -3,7 +3,7 @@ import Mousetrap from 'mousetrap';
import
_
from
'
underscore
'
;
import
Sidebar
from
'
./right_sidebar
'
;
import
Shortcuts
from
'
./shortcuts
'
;
import
{
CopyAsGFM
}
from
'
./behaviors/copy_as_gfm
'
;
import
{
CopyAsGFM
}
from
'
./behaviors/
markdown/
copy_as_gfm
'
;
export
default
class
ShortcutsIssuable
extends
Shortcuts
{
constructor
(
isMergeRequest
)
{
...
...
lib/banzai/pipeline/gfm_pipeline.rb
View file @
c1708514
...
...
@@ -2,10 +2,10 @@ module Banzai
module
Pipeline
class
GfmPipeline
<
BasePipeline
# These filters convert GitLab Flavored Markdown (GFM) to HTML.
# The handlers defined in app/assets/javascripts/copy_as_gfm.js
# The handlers defined in app/assets/javascripts/
behaviors/markdown/
copy_as_gfm.js
# consequently convert that same HTML to GFM to be copied to the clipboard.
# Every filter that generates HTML from GFM should have a handler in
# app/assets/javascripts/copy_as_gfm.js, in reverse order.
# app/assets/javascripts/
behaviors/markdown/
copy_as_gfm.js, in reverse order.
# The GFM-to-HTML-to-GFM cycle is tested in spec/features/copy_as_gfm_spec.rb.
def
self
.
filters
@filters
||=
FilterArray
[
...
...
spec/features/markdown/copy_as_gfm_spec.rb
View file @
c1708514
...
...
@@ -20,7 +20,7 @@ describe 'Copy as GFM', :js do
end
# The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert GitLab Flavored Markdown (GFM) to HTML.
# The handlers defined in app/assets/javascripts/copy_as_gfm.js consequently convert that same HTML to GFM.
# The handlers defined in app/assets/javascripts/
behaviors/markdown/
copy_as_gfm.js consequently convert that same HTML to GFM.
# To make sure these filters and handlers are properly aligned, this spec tests the GFM-to-HTML-to-GFM cycle
# by verifying (`html_to_gfm(gfm_to_html(gfm)) == gfm`) for a number of examples of GFM for every filter, using the `verify` helper.
...
...
spec/javascripts/behaviors/copy_as_gfm_spec.js
View file @
c1708514
import
{
CopyAsGFM
}
from
'
~/behaviors/copy_as_gfm
'
;
import
{
CopyAsGFM
}
from
'
~/behaviors/
markdown/
copy_as_gfm
'
;
describe
(
'
CopyAsGFM
'
,
()
=>
{
describe
(
'
CopyAsGFM.pasteGFM
'
,
()
=>
{
...
...
spec/javascripts/issue_show/components/app_spec.js
View file @
c1708514
import
Vue
from
'
vue
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
'
~/render_math
'
;
import
'
~/render_gfm
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
issuableApp
from
'
~/issue_show/components/app.vue
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
...
...
spec/javascripts/merge_request_notes_spec.js
View file @
c1708514
...
...
@@ -3,8 +3,7 @@ import _ from 'underscore';
import
'
autosize
'
;
import
'
~/gl_form
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/render_gfm
'
;
import
'
~/render_math
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
Notes
from
'
~/notes
'
;
const
upArrowKeyCode
=
38
;
...
...
spec/javascripts/notes/components/note_app_spec.js
View file @
c1708514
...
...
@@ -3,7 +3,7 @@ import _ from 'underscore';
import
Vue
from
'
vue
'
;
import
notesApp
from
'
~/notes/components/notes_app.vue
'
;
import
service
from
'
~/notes/services/notes_service
'
;
import
'
~/render_gfm
'
;
import
'
~/
behaviors/markdown/
render_gfm
'
;
import
*
as
mockData
from
'
../mock_data
'
;
const
vueMatchers
=
{
...
...
spec/javascripts/notes_spec.js
View file @
c1708514
...
...
@@ -7,7 +7,7 @@ import * as urlUtils from '~/lib/utils/url_utility';
import
'
autosize
'
;
import
'
~/gl_form
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/render_gfm
'
;
import
'
~/
behaviors/markdown/
render_gfm
'
;
import
Notes
from
'
~/notes
'
;
import
timeoutPromise
from
'
./helpers/set_timeout_promise_helper
'
;
...
...
spec/javascripts/shortcuts_issuable_spec.js
View file @
c1708514
import
$
from
'
jquery
'
;
import
initCopyAsGFM
from
'
~/behaviors/copy_as_gfm
'
;
import
initCopyAsGFM
from
'
~/behaviors/
markdown/
copy_as_gfm
'
;
import
ShortcutsIssuable
from
'
~/shortcuts_issuable
'
;
initCopyAsGFM
();
...
...
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