diff options
author | Douwe Maan <douwe@selenight.nl> | 2019-03-23 14:09:14 +0100 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2019-03-26 14:29:33 +0100 |
commit | 838f7e56a407aa335cf4406632373bac3d05dee0 (patch) | |
tree | 07848abf08df3b4724e6e2a746636856766ab95f /app | |
parent | 30479246ed4ed2cdbadb4d359a38e592ffef2fe5 (diff) | |
download | gitlab-ce-838f7e56a407aa335cf4406632373bac3d05dee0.tar.gz |
Remove .wiki and @md-typography mixin in favor of .md and .md-file
Before, the styling for `img:not(.emoji)`` was repeated between
`.md:not(.use-csslab):not(.wiki)` (for comments and the Markdown
preview), `.documentation.wiki` (for help pages), and
`.issuable-details .description .wiki` (for MR and issue descriptions).
In these places, we now simply use `.md`. Wherever we use `.md` but
don't want this image styling (like wikis and blobs), `.md-file` is
added.
Diffstat (limited to 'app')
25 files changed, 49 insertions, 86 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js index 58cf057b2c2..83d4196d0aa 100644 --- a/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js +++ b/app/assets/javascripts/behaviors/markdown/copy_as_gfm.js @@ -10,7 +10,7 @@ export class CopyAsGFM { const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); if (isIOS) return; - $(document).on('copy', '.md, .wiki', e => { + $(document).on('copy', '.md', e => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); }); $(document).on('copy', 'pre.code.highlight, .diff-content .line_content', e => { @@ -99,7 +99,7 @@ export class CopyAsGFM { } static transformGFMSelection(documentFragment) { - const gfmElements = documentFragment.querySelectorAll('.md, .wiki'); + const gfmElements = documentFragment.querySelectorAll('.md'); switch (gfmElements.length) { case 0: { return documentFragment; diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js index 680f2031409..670f66b005e 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js @@ -37,7 +37,7 @@ export default class ShortcutsIssuable extends Shortcuts { } // Sanity check: Make sure the selected text comes from a discussion : it can either contain a message... - let foundMessage = !!documentFragment.querySelector('.md, .wiki'); + let foundMessage = !!documentFragment.querySelector('.md'); // ... Or come from a message if (!foundMessage) { @@ -46,7 +46,7 @@ export default class ShortcutsIssuable extends Shortcuts { let node = e; do { // Text nodes don't define the `matches` method - if (node.matches && node.matches('.md, .wiki')) { + if (node.matches && node.matches('.md')) { foundMessage = true; } node = node.parentNode; diff --git a/app/assets/javascripts/issue_show/components/description.vue b/app/assets/javascripts/issue_show/components/description.vue index 58f14bac8c8..732184dc782 100644 --- a/app/assets/javascripts/issue_show/components/description.vue +++ b/app/assets/javascripts/issue_show/components/description.vue @@ -140,7 +140,7 @@ export default { 'issue-realtime-pre-pulse': preAnimation, 'issue-realtime-trigger-pulse': pulseAnimation, }" - class="wiki" + class="md" v-html="descriptionHtml" ></div> <textarea diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index 6108eaa1ad0..703f9b203eb 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -123,7 +123,7 @@ } } - &.wiki { + &.md { padding: $gl-padding; @include media-breakpoint-up(md) { diff --git a/app/assets/stylesheets/framework/typography.scss b/app/assets/stylesheets/framework/typography.scss index 5e5e8bcc3d6..89b8957543d 100644 --- a/app/assets/stylesheets/framework/typography.scss +++ b/app/assets/stylesheets/framework/typography.scss @@ -1,4 +1,8 @@ -@mixin md-typography { +/** + * Apply Markdown typography + * + */ +.md:not(.use-csslab) { color: $gl-text-color; word-wrap: break-word; @@ -28,6 +32,14 @@ max-width: 100%; } + &:not(.md-file) img:not(.emoji) { + border: 1px solid $white-normal; + padding: 5px; + margin: 5px 0; + // Ensure that image does not exceed viewport + max-height: calc(100vh - 100px); + } + p a:not(.no-attachment-icon) img { // Remove bottom padding because // <p> already has $gl-padding bottom @@ -368,28 +380,6 @@ code { } /** - * Apply Markdown typography - * - */ -.wiki:not(.use-csslab) { - @include md-typography; -} - -.md:not(.use-csslab) { - @include md-typography; - - &:not(.wiki) { - img:not(.emoji) { - border: 1px solid $white-normal; - padding: 5px; - margin: 5px 0; - // Ensure that image does not exceed viewport - max-height: calc(100vh - 100px); - } - } -} - -/** * Textareas intended for GFM * */ diff --git a/app/assets/stylesheets/pages/help.scss b/app/assets/stylesheets/pages/help.scss index 161d4dbfb22..7610c5cf6f3 100644 --- a/app/assets/stylesheets/pages/help.scss +++ b/app/assets/stylesheets/pages/help.scss @@ -37,12 +37,4 @@ .documentation { padding: 7px; - - // Border around images in the help pages. - img:not(.emoji) { - border: 1px solid $white-normal; - padding: 5px; - margin: 5px; - max-height: calc(100vh - 100px); - } } diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 623fa485ba6..9e2375b84d0 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -72,14 +72,6 @@ height: $gl-padding * 2; } - // Border around images in issue and MR descriptions. - .description img:not(.emoji) { - border: 1px solid $white-normal; - padding: 5px; - max-height: calc(100vh - 100px); - max-width: 100%; - } - .emoji-block { padding: 10px 0; } diff --git a/app/assets/stylesheets/pages/wiki.scss b/app/assets/stylesheets/pages/wiki.scss index 82e887aa62a..3260aed143e 100644 --- a/app/assets/stylesheets/pages/wiki.scss +++ b/app/assets/stylesheets/pages/wiki.scss @@ -179,9 +179,3 @@ ul.wiki-pages-list.content-list { } } } - -.wiki:not(.use-csslab) { - table { - @include markdown-table; - } -} diff --git a/app/assets/stylesheets/print.scss b/app/assets/stylesheets/print.scss index bb10928a037..9ed1600419d 100644 --- a/app/assets/stylesheets/print.scss +++ b/app/assets/stylesheets/print.scss @@ -1,21 +1,21 @@ -.wiki h1, -.wiki h2, -.wiki h3, -.wiki h4, -.wiki h5, -.wiki h6 { +.md h1, +.md h2, +.md h3, +.md h4, +.md h5, +.md h6 { margin-top: 17px; } -.wiki h1 { +.md h1 { font-size: 30px; } -.wiki h2 { +.md h2 { font-size: 22px; } -.wiki h3 { +.md h3 { font-size: 18px; font-weight: 600; } diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index dfa5d820ce9..f40fdb0b86b 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -29,7 +29,7 @@ .row.prepend-top-default .col-md-8 - .documentation-index.wiki + .documentation-index.md = markdown(@help_index) .col-md-4 .card diff --git a/app/views/help/instance_configuration.html.haml b/app/views/help/instance_configuration.html.haml index f09e3825a4b..99576d45f76 100644 --- a/app/views/help/instance_configuration.html.haml +++ b/app/views/help/instance_configuration.html.haml @@ -1,5 +1,5 @@ - page_title 'Instance Configuration' -.wiki.documentation +.documentation.md %h1 Instance Configuration %p diff --git a/app/views/help/show.html.haml b/app/views/help/show.html.haml index c07c148a12a..dce27dee9be 100644 --- a/app/views/help/show.html.haml +++ b/app/views/help/show.html.haml @@ -1,3 +1,3 @@ - page_title @path.split("/").reverse.map(&:humanize) -.documentation.wiki.prepend-top-default +.documentation.md.prepend-top-default = markdown @markdown diff --git a/app/views/help/ui.html.haml b/app/views/help/ui.html.haml index 506f580b246..969df69aafb 100644 --- a/app/views/help/ui.html.haml +++ b/app/views/help/ui.html.haml @@ -513,7 +513,7 @@ %h2#markdown Markdown %h4 - %code .md or .wiki and others + %code .md Markdown rendering has a bit different css and presented in next UI elements: diff --git a/app/views/projects/_wiki.html.haml b/app/views/projects/_wiki.html.haml index de4653dad2c..6103d86bf5a 100644 --- a/app/views/projects/_wiki.html.haml +++ b/app/views/projects/_wiki.html.haml @@ -1,8 +1,7 @@ - if @wiki_home.present? %div{ class: container_class } - .prepend-top-default.append-bottom-default - .wiki - = render_wiki_content(@wiki_home) + .md.md-file.prepend-top-default.append-bottom-default + = render_wiki_content(@wiki_home) - else - can_create_wiki = can?(current_user, :create_wiki, @project) .landing{ class: [('row-content-block row p-0 align-items-center' if can_create_wiki), ('content-block' unless can_create_wiki)] } diff --git a/app/views/projects/blob/preview.html.haml b/app/views/projects/blob/preview.html.haml index 66687f087ff..800ee2d61c8 100644 --- a/app/views/projects/blob/preview.html.haml +++ b/app/views/projects/blob/preview.html.haml @@ -1,7 +1,7 @@ .diff-file.file-holder .diff-content - if markup?(@blob.name) - .file-content.wiki.md{ class: ('use-csslab' if Feature.enabled?(:csslab)) } + .file-content.md.md-file{ class: ('use-csslab' if Feature.enabled?(:csslab)) } = markup(@blob.name, @content) - else .file-content.code.js-syntax-highlight diff --git a/app/views/projects/blob/viewers/_markup.html.haml b/app/views/projects/blob/viewers/_markup.html.haml index 1a77eb078be..abc74b66e90 100644 --- a/app/views/projects/blob/viewers/_markup.html.haml +++ b/app/views/projects/blob/viewers/_markup.html.haml @@ -1,4 +1,4 @@ - blob = viewer.blob - context = blob.respond_to?(:rendered_markup) ? { rendered: blob.rendered_markup } : {} -.file-content.wiki.md{ class: ('use-csslab' if Feature.enabled?(:csslab)) } +.file-content.md.md-file{ class: ('use-csslab' if Feature.enabled?(:csslab)) } = markup(blob.name, blob.data, context) diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 3a674da6e87..00fbfd80ce5 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -72,7 +72,7 @@ %h2.title= markdown_field(@issue, :title) - if @issue.description.present? .description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' } - .wiki= markdown_field(@issue, :description) + .md= markdown_field(@issue, :description) %textarea.hidden.js-task-list-field= @issue.description = edited_time_ago_with_tooltip(@issue, placement: 'bottom', html_class: 'issue-edited-ago js-issue-edited-ago') diff --git a/app/views/projects/merge_requests/_mr_box.html.haml b/app/views/projects/merge_requests/_mr_box.html.haml index 1a9ab288683..7f2c9dcacfd 100644 --- a/app/views/projects/merge_requests/_mr_box.html.haml +++ b/app/views/projects/merge_requests/_mr_box.html.haml @@ -5,7 +5,7 @@ %div - if @merge_request.description.present? .description{ class: can?(current_user, :update_merge_request, @merge_request) ? 'js-task-list-container' : '' } - .wiki + .md = markdown_field(@merge_request, :description) %textarea.hidden.js-task-list-field = @merge_request.description diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 0542b349e44..78b416edd5c 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -54,9 +54,8 @@ %div - if @milestone.description.present? - .description - .wiki - = markdown_field(@milestone, :description) + .description.md + = markdown_field(@milestone, :description) = render_if_exists 'shared/milestones/burndown', milestone: @milestone, project: @project diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index cc203cfad86..8bfface3f5a 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -20,9 +20,8 @@ %p = s_("TagsPage|Can't find HEAD commit for this tag") - if release && release.description.present? - .description.prepend-top-default - .wiki - = markdown_field(release, :description) + .description.md.prepend-top-default + = markdown_field(release, :description) .row-fixed-content.controls.flex-row = render 'projects/buttons/download', project: @project, ref: tag.name, pipeline: @tags_pipelines[tag.name] diff --git a/app/views/projects/tags/show.html.haml b/app/views/projects/tags/show.html.haml index 8ee1407d9d9..0be62bc5612 100644 --- a/app/views/projects/tags/show.html.haml +++ b/app/views/projects/tags/show.html.haml @@ -39,8 +39,7 @@ .append-bottom-default.prepend-top-default - if @release.description.present? - .description - .wiki - = markdown_field(@release, :description) + .description.md + = markdown_field(@release, :description) - else = s_('TagsPage|This tag has no release notes.') diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml index 8e1c054b50c..40d674f3fec 100644 --- a/app/views/projects/wikis/show.html.haml +++ b/app/views/projects/wikis/show.html.haml @@ -26,7 +26,7 @@ = (s_("WikiHistoricalPage|You can view the %{most_recent_link} or browse the %{history_link}.") % { most_recent_link: most_recent_link, history_link: history_link }).html_safe .prepend-top-default.append-bottom-default - .wiki.md{ class: ('use-csslab' if Feature.enabled?(:csslab)) } + .md.md-file{ class: ('use-csslab' if Feature.enabled?(:csslab)) } = render_wiki_content(@page) = render 'sidebar' diff --git a/app/views/search/results/_snippet_blob.html.haml b/app/views/search/results/_snippet_blob.html.haml index a60a4501557..f17dae0a94c 100644 --- a/app/views/search/results/_snippet_blob.html.haml +++ b/app/views/search/results/_snippet_blob.html.haml @@ -18,7 +18,7 @@ %i.fa.fa-file %strong= snippet.file_name - if markup?(snippet.file_name) - .file-content.wiki + .file-content.md.md-file - snippet_chunks.each do |chunk| - unless chunk[:data].empty? = markup(snippet.file_name, chunk[:data]) diff --git a/app/views/shared/milestones/_top.html.haml b/app/views/shared/milestones/_top.html.haml index 55b1c14022f..edaeff782de 100644 --- a/app/views/shared/milestones/_top.html.haml +++ b/app/views/shared/milestones/_top.html.haml @@ -42,9 +42,8 @@ = markdown_field(milestone, :title) - if milestone.group_milestone? && milestone.description.present? %div - .description - .wiki - = markdown_field(milestone, :description) + .description.md + = markdown_field(milestone, :description) - if milestone.complete?(current_user) && milestone.active? .alert.alert-success.prepend-top-default diff --git a/app/views/shared/snippets/_header.html.haml b/app/views/shared/snippets/_header.html.haml index 0c07eae8643..ebb634fe75f 100644 --- a/app/views/shared/snippets/_header.html.haml +++ b/app/views/shared/snippets/_header.html.haml @@ -22,7 +22,7 @@ - if @snippet.description.present? .description.qa-snippet-description - .wiki + .md = markdown_field(@snippet, :description) %textarea.hidden.js-task-list-field = @snippet.description |