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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9b873276
Commit
9b873276
authored
Mar 12, 2020
by
julien MILLAU
Committed by
Kushal Pandya
Mar 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mermaid flowchart width
parent
36ff94ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
app/assets/javascripts/behaviors/markdown/render_mermaid.js
app/assets/javascripts/behaviors/markdown/render_mermaid.js
+1
-0
changelogs/unreleased/fix-mermaid-flow-chart-width.yml
changelogs/unreleased/fix-mermaid-flow-chart-width.yml
+5
-0
spec/features/markdown/mermaid_spec.rb
spec/features/markdown/mermaid_spec.rb
+25
-2
No files found.
app/assets/javascripts/behaviors/markdown/render_mermaid.js
View file @
9b873276
...
...
@@ -35,6 +35,7 @@ function renderMermaids($els) {
// mermaidAPI options
theme
:
'
neutral
'
,
flowchart
:
{
useMaxWidth
:
true
,
htmlLabels
:
false
,
},
securityLevel
:
'
strict
'
,
...
...
changelogs/unreleased/fix-mermaid-flow-chart-width.yml
0 → 100644
View file @
9b873276
---
title
:
Fix Mermaid flowchart width
merge_request
:
26848
author
:
julien MILLAU
type
:
fixed
spec/features/markdown/mermaid_spec.rb
View file @
9b873276
...
...
@@ -94,8 +94,31 @@ describe 'Mermaid rendering', :js do
page
.
find
(
'summary'
).
click
svg
=
page
.
find
(
'svg.mermaid'
)
expect
(
svg
[
:width
].
to_i
).
to
be_within
(
5
).
of
(
120
)
expect
(
svg
[
:height
].
to_i
).
to
be_within
(
5
).
of
(
220
)
expect
(
svg
[
:style
]).
to
match
(
/max-width/
)
expect
(
svg
[
:width
].
to_i
).
to
eq
(
100
)
expect
(
svg
[
:height
].
to_i
).
to
eq
(
0
)
end
end
it
'correctly sizes mermaid diagram block'
,
:js
do
description
=
<<~
MERMAID
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
MERMAID
project
=
create
(
:project
,
:public
)
issue
=
create
(
:issue
,
project:
project
,
description:
description
)
visit
project_issue_path
(
project
,
issue
)
svg
=
page
.
find
(
'svg.mermaid'
)
expect
(
svg
[
:style
]).
to
match
(
/max-width/
)
expect
(
svg
[
:width
].
to_i
).
to
eq
(
100
)
expect
(
svg
[
:height
].
to_i
).
to
eq
(
0
)
end
end
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