about.gitlab.com Markdown Guide
Note
This style guide is for the files in thewww-gitlab-com
repository which populate parts of the about.gitlab.com
website.
For the handbook, refer to the handbook markdown guide
Markdown Style Guide for about.gitlab.com
This style guide is for about.gitlab.com
. For styles in the GitLab Handbook see the Handbook Markdown Guide. For styles in the GitLab UI, see the GitLab Flavored Markdown documentation.
The about.gitlab.com
website was generated by Middleman, a blog-aware Static Site Generator (SSG) widely used by web developers.
Markup language is part of the structure of any SSG. It is a system to write documents making them somehow
syntactically distinguishable from text. Lightweight markup languages have a simplified and unobtrusive syntax,
designed to be easily written within any text editor. That’s what we use to write our content. The majority of
SSGs use markdown engines for this purpose. Read through our blog post on [Modern Static Site Generators][ssgs-post]
to understand how they work.
For about.gitlab.com
we use kramdown, which is an advanced Markdown engine with a lot of interesting features that most of the other engines don’t have, such as inline attribute lists (IALs), which enable easy styling beyond the standard Markdown options. kramdown has documentation on how their markdown parser works, as well as documentation for their full syntax.
If you never have written a single line in markdown markup, don’t worry, it’s easy to learn and even easier to use. You’ll probably be surprised how handy it is once you get used to it. And you’ll miss it whenever the tech you’re using doesn’t support markdown.
In most of GitLab text areas you’ll find markdown support. Not all of them run with kramdown, so the markup will not behave equally “GitLabwide”. For GitLab.com, GitLab CE and GitLab EE text areas, the markdown engine is currently CommonMarker. Here you can find the markdown style guide for them.
This guide has been made to make it easier for everyone to use kramdown features and save a lot of time writing content for
about.gitlab.com
, including handbook pages, website pages, blog posts and everything else within the project www-gitlab-com.
There are different possible syntaxes for most of the markups described below, but this guide is to be considered the
standard for about.gitlab.com
.
Note: This document is maintained by the Technical Writing Team.
Blog
For our Blog, everything in this guide can be applied. Read through the Blog Formatting Guidelines for further information.
Headings
## Heading h2
### Heading h3
#### Heading h4
Notes:
- We don’t use
h1
headings, as they already are displayed on every page as its title, and we should not apply more than oneh1
per page.When you use a top level heading, or an
<h1>
, you’re setting up a semantic relationship between that heading and the remainder of the content on a page, describing what it is about. If you then use a second<h1>
on the same page, you’re creating some potential confusion, because someone, or a search engine might see that as the ending of the semantic relationship between the content after the first<h1>
and the start of this new<h1>
. [SEO Guide] - Always start with
h2
(##
), and respect the orderh2
→h3
→h4
. Never skip the hierarchy level, such ash2
→h4
.The six heading elements, H1 through H6, denote section headings. Although the order and occurrence of headings is not constrained by the HTML DTD, documents should not skip levels (for example, from H1 to H3), as converting such documents to other representations is often problematic. [W3C]
- Always leave a blank space between the hash
#
and the text next to it, otherwise it won’t render properly. - For keeping the text clear and the markdown consistent, jump a line between any heading and its subsequent paragraph.
Paragraphs, breaks, and horizontal lines
Regular paragraphs are obtained by just writing text lines:
- If you hit enter between two lines, both lines will be joined into a single paragraph, which is called wrapping text.
- If you leave a blank line between them, they will split into two paragraphs.
- If you end a line with a backslash (
\
) or two spaces, the next line appears on a new line in the same paragraph (a line break).
In some Git tools, diffs
in future MRs may be easier to understand with additional line breaks, however GitLab’s web interface as well as many desktop Git tools feature substring change highlighting within lines and side-by-side or similar version comparison so there is no need for artificial line breaks.
Wrapping Text
Splitting long lines (preferably up to 100 characters) can make it easier to provide feedback on small chunks of text.
Regular paragraphs and automatic join
This text is a paragraph.
This won't be another paragraph, it will join the line above it.
This will be another paragraph, as it has a blank line above it.
This text is a paragraph. This won’t be another paragraph, it will join the line above it.
This will be another paragraph, as it has a blank line above it.
Additional breaks
In case you need an additional break (or some extra space between lines), you can simply use the HTML break tag <br>
,
leaving blank lines above and below it:
Text A
<!-- blank line -->
<br>
<!-- blank line -->
Text B
Text A
Text B
Horizontal lines
A sequence of three or more dashes will produce a horizontal line, but let’s use always 4 as standard. Leave blank lines after and before it:
Text
<!-- blank line -->
----
<!-- blank line -->
Text
Text
Text
Emphasis: bold and italic
To display bold or italic text, wrap it in 2 stars (for bold) or underscores (for italic). For both italic and bold, wrap it in 3 stars:
This is **bold** and this is _italic_.
This is ***bold and italic***.
This is bold and this is italic.
This is bold and italic.
Markdown doesn’t natively support underlined text. If necessary you can hardcode it with the
HTML tag ins
(<ins>underlined text</ins>
), however, it is inadvisable to do so.
Links
There are a few different ways to display links with markdown markup, but to keep some standards, let’s try to use the following options only.
Important notes: {: #links-important-notes}
- {: #note-meaningful-links} Don’t take it as a restrictive rule, but avoid using meaningless text for links as “this article” or “read here.” The link text should be meaningful even if taken out of context; this makes the links more useful and accessible for people using screen readers.
- {: #note-deadlinks-checker} Check for broken links: http://www.deadlinkchecker.com/
Inline Links
We’d rather use inline links, such as [Text to display](link)
, as they are easier to maintain. To make an inline link open in a new tab, you can add {:target="_blank"} to the end. Ex: [Text to display](link){:target="_blank"}
Relative links
Use relative links when referring to links found on about.gitlab.com. For example, a link to our blog handbook should look like this /handbook/marketing/blog/
and not this https://about.gitlab.com/handbook/marketing/blog/
. Remove everything from the https
through about.gitlab.com
, but retain the forward slash after .com
.
Learn more in the Markdown Guide.
For links to GitLab.com or anywhere else you must use the entire link, including the http:
.
While reference (identifier) links are posssible, they are generally discouraged as the references are often orphaned when the content is changed.
Mailto links
If you’re adding an email address to a page be sure to format your link with mailto
to avoid creating broken links. For example, [example@gitlab.com](mailto:example@gitlab.com)
Lists
Both ordered and unordered lists are very straightforward to produce. There are a few ways to produce the same results, but let’s stick with the following, again, to maintain some standards.
- Always start list items with a capital letter.
- Always leave a blank line before and after a list.
- Begin a line with spaces (not tabs) to denote a nested sub-item. Items nested in lists should always align with the first character of the list item.
- For Unordered lists, use two spaces for each level of indentation.
- For Ordered lists, use three spaces for each level of indentation.
Tip: don’t leave blank lines between the items, unless you have a reason to do so.
Important: always leave a blank line between Headings and the subsequent list! If you don’t, the list will not render. {: .alert .alert-info}
The Writing Style Guide recommends using ordered lists when you have multiple items, because Numbered lists are easier to reference during a discussion over bulleted lists
.
Note: This guidance does not apply to product documentation.
See the Documentation Style Guide for other helpful tips.
Ordered lists
Ordered lists are pretty easy to create. Couldn’t be more intuitive:
Paragraph:
1. Item one
1. Sub item one
2. Sub item two
3. Sub item three
2. Item two
Paragraph:
- Item one
- Sub item one
- Sub item two
- Sub item three
- Item two
To be practical and avoid errors on the numbers, use “1” for all the items. The markdown engine will output them in the correct order.
Paragraph:
1. Item one
1. Sub item one
1. Sub item two
1. Item two
1. Item three
Paragraph:
- Item one
- Sub item one
- Sub item two
- Item two
- Item three
Unordered lists
Unordered lists are very easy to create too:
Paragraph:
- Item 1
- Item 2
- Item 3
- Sub item 1
- Sub item 2
- Item 4
Paragraph:
- Item 1
- Item 2
- Item 3
- Sub item 1
- Sub item 2
- Item 4
Split lists
Let’s say, for some reason, you want to split a list in different parts. To do that, use the
markup ^
to indicate the end of a list and the beginning of the next:
- list one - item 1
- list one - item 2
- sub item 1
- sub item 2
- list one - item 3
^
- list two - item A
- list two - item B
^
- list three - item _i_
- list three - item _ii_
- list one - item 1
- list one - item 2
- sub item 1
- sub item 2
- list one - item 3 ^
- list two - item A
- list two - item B ^
- list three - item i
- list three - item ii
Images
To insert images to your markdown file, use the markup ![ALT](/path/image.ext)
. The path can either
be relative to the website, or a full URL for an external image. The supported formats are
.png
, .jpg
, .gif
. You might be able to use some .svg
files too, depending on its structure.
![Semantic description of image](/images/path/to/folder/image.png "Image Title")
You can also use an identifier, as we do for links:
![Semantic description of image][identifier]
If you want to add a caption to your image, it’s easily achieved with:
![Semantic description of image](/images/path/to/folder/image.png)*My caption*
For clickable images, simply wrap the image markup into a link markup:
[![Semantic description of image](/images/path/to/folder/image.png "Hello World")*My caption*][about.gitlab.com]
[My caption][about.gitlab.com]
Important notes:
{: #image-shadow}
Apply shadow to your images!{: #image-requirements}
All images must be placed under/source/images/
, in an appropriate directory. Only screenshots and public domain images are permitted.{: #image-alt-text}
The text inside the square brackets is an image attribute calledALT
, which stands for alternative text. Including descriptive alt text helps maintain accessibility for every visitor and should always be included with an image. When you add alt text be sure to describe the content and function of an image. In addition to the accessibility benefits,ALT
is useful for SEO, and it is displayed when, for some reason, that image is not loaded by the browser.{: #image-filename}
For the same reasons, the image must contain a name related to it. Example: instead ofimage-01.jpg
, name itblack-dog.jpg
, if it’s a photo of a black dog.{: #image-title}
It’s also recommendable adding an image title, as the “Hello World” exemplified above.
Diagrams
There are two ways to insert diagrams via Markdown:
- Mermaid
- PlantUML
Mermaid
See the examples in the GitLab docs on how to use Mermaid. We have a number of Handbook-specific example in the Tools and Tips Section.
PlantUML
You can use PlantUML in Markdown blocks. For example:
```plantuml
!define ICONURL https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/v2.1.0
skinparam defaultTextAlignment center
!include ICONURL/common.puml
!include ICONURL/font-awesome-5/gitlab.puml
!include ICONURL/font-awesome-5/java.puml
!include ICONURL/font-awesome-5/rocket.puml
!include ICONURL/font-awesome/newspaper_o.puml
FA_NEWSPAPER_O(news,good news!,node) #White {
FA5_GITLAB(gitlab,GitLab.com,node) #White
FA5_JAVA(java,PlantUML,node) #White
FA5_ROCKET(rocket,Integrated,node) #White
}
gitlab ..> java
java ..> rocket
```
!define ICONURL https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/v2.1.0
skinparam defaultTextAlignment center
!include ICONURL/common.puml
!include ICONURL/font-awesome-5/gitlab.puml
!include ICONURL/font-awesome-5/java.puml
!include ICONURL/font-awesome-5/rocket.puml
!include ICONURL/font-awesome/newspaper_o.puml
FA_NEWSPAPER_O(news,good news!,node) #White {
FA5_GITLAB(gitlab,GitLab.com,node) #White
FA5_JAVA(java,PlantUML,node) #White
FA5_ROCKET(rocket,Integrated,node) #White
}
gitlab ..> java
java ..> rocket
Videos
There are two ways of displaying videos: within HTML5 <video>
tags and within <iframe>
tags.
Display videos from YouTube
This method works for YouTube videos and any other embed video within an <iframe>
tag.
- Copy the code below and paste it into your markdown file. Leave a blank line above and below it. Do NOT edit the code block (e.g., remove spaces - the video iframe may not render properly)
- Go the video URL you want to display
- Click on “Share”, then “Embed”
- Copy the
<iframe>
source (src
) URL only, and paste it replacing thesrc
below:
<!-- blank line -->
<figure class="video_container">
<iframe src="https://www.youtube.com/embed/enMumwvLAug" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
<!-- blank line -->
Display local videos (HTML5)
This method works for any video uploaded to somewhere retrievable from the internet from a URL, or from a relative
path like path/to/video.mp4
.
- Read through the w3schools HTML5 video guide, or the MDN
<video>
guide. - Record or export the video in these three formats to achieve cross-browser and cross-device
compatibility:
.mp4
,.ogg
and.webm
. - Get the URL for your video
- Choose an image to use as a poster
- Copy the code below and paste it to your file
- Replace the
src
URLs for your video URLs
<!-- blank line -->
<figure class="video_container">
<video controls="true" allowfullscreen="true" poster="path/to/poster_image.png">
<source src="path/to/video.mp4" type="video/mp4">
<source src="path/to/video.ogg" type="video/ogg">
<source src="path/to/video.webm" type="video/webm">
</video>
</figure>
<!-- blank line -->
Note: In case you don’t have all formats recommended by w3schools, you can use just one of them,
but your video most likely won’t be supported in all devices and browsers. The video above (.mp4
only)
worked on Mozilla Firefox for macOS, Android, and Windows, and on Chrome for Android and for Windows.
But it may not work on other devices/browser, such as Chrome for macOS and iOS, or Safari.
In fact, the best option is using YouTube or Vimeo embed videos in <iframe>
tags.*
Display other videos
For any other videos, such as from Vimeo or Google Drive, grab the video iframe only, and proceed
like we do for YouTube videos, wrapping the <iframe>
within a <figure class="video_container">
, for responsiveness. Copy and paste the code below,
replacing only the iframe URL with your own:
<!-- blank line -->
<figure class="video_container">
<iframe src="https://drive.google.com/file/d/0B6m34D8cFdpMZndKTlBRU0tmczg/preview" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
<!-- blank line -->
Display multiple videos
To display multiple videos on the same page, just repeat the figure
code block
where you want them to show up, replacing the video ID with the respective ID
corresponding to your videos.
To display multiple videos in a sequence, just copy the figure
code block and
paste it as many times as necessary. Always leave a blank line between the blocks.
Do NOT remove the spaces, otherwise your videos may not render properly.
<!-- blank line -->
<figure class="video_container">
<iframe src="https://drive.google.com/file/d/0B6m34D8cFdpMZndKTlBRU0tmczg/preview" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
<figure class="video_container">
<iframe src="https://drive.google.com/file/d/0B6m34D8cFdpMZndKTlBRU0tmczg/preview" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
<figure class="video_container">
<iframe src="https://drive.google.com/file/d/0B6m34D8cFdpMZndKTlBRU0tmczg/preview" frameborder="0" allowfullscreen="true"> </iframe>
</figure>
<!-- blank line -->
Table of Contents (ToC)
With kramdown, creating a Table of Contents is the easiest thing ever! The automatic ToC will include every heading in the document, unless you don’t want it to be included. You do not need to add anchors individually to every title. This is an automated process.
----
----
As always, leave a blank line before and after the markup. Note that there are four dashes beginning
and closing the block, which is not required, but recommendable for keeping the same standards throughout about.gitlab.com
.
The heading “On this page” can be adapted to your case, e.g., “In this tutorial”, or “In this guide”, etc. It’s not required either, but recommended.
The markup `` is used every time you don’t want to include a heading into the ToC. Just add
it right below the heading, and it won’t be included into the ToC. In fact no_toc
is a
custom class, as described later in this guide.
The output ToC can be found at the very beginning of this page.
Alternatively, you can use ordered ToC too, displaying numbers at the beginning of the list. Just use the markup for ordered lists and kramdown will be smart enough to understand what you want:
1. TOC
Tables
Tables for markdown are challenging. So, we have two possible approaches: use markdown whenever possible, but if you need pretty advanced table layouts, you are free to add them in HTML markup instead.
Markdown is not a replacement for HTML, or even close to it. ([John Gruber][daring-quote]) {: #quote}
As explained by John Gruber, the creator of markdown, it was not created to replace HTML, so there are situations we can’t avoid using HTML. With complex tables, that’s the case.
Note: For very simple 2 column tables it is better to use lists with strong text in preference to the complexity of using markdown tables.
The following table has a header (first line), then markup to define the desired alignment (dashes and colons), then the table body. You can go ahead and add separators to create subsequent table bodies.
However you prepare your table, its design will depend upon the CSS styles defined for them.
The last markup {: .custom-class #custom-id}
can be used in case you want to attribute
a custom class and/or a custom ID to the <table>
element.
| Default aligned | Left aligned | Center aligned | Right aligned |
|-----------------|:-------------|:---------------:|---------------:|
| First body part | Second cell | Third cell | fourth cell |
| Second line | foo | **strong** | baz |
| Third line | quux | baz | bar |
|-----------------+--------------+-----------------+----------------|
| Second body | | | |
| 2nd line | | | |
|-----------------+--------------+-----------------+----------------|
| Third body | | | Foo |
{: .custom-class #custom-id}
Default aligned | Left aligned | Center aligned | Right aligned |
---|---|---|---|
First body part | Second cell | Third cell | fourth cell |
Second line | foo | strong | baz |
Third line | quux | baz | bar |
—————–+————–+—————–+—————- | |||
Second body | |||
2nd line | Hello World | ||
—————–+————–+—————–+—————- | |||
Third body | Foo | ||
{: .custom-class #custom-id} |
The bars, spaces, and dashes were used symmetrically in the previous example to help future page developers if they need to edit the table’s contents. The symmetry isn’t required.
Some development tools can help you create your own complex table if you need to merge lines or columns, or if you require a more complex layout. This table generator may be able to help you do this.
To add a numbered list in a table cell, add a blank line between the heading and the table to render the table correctly. Otherwise, the text and formatting won’t appear.
See the kramdown syntax guide for more information about tables.
Collapse
A collapsed content section is used to hide information until a user chooses to reveal it with a click or tap on the summary text. The hidden content is revealed inline. For example, this code:
<details>
<summary markdown="span">This is the summary text, click me to expand</summary>
This is the detailed text.
We can still use markdown, but we need to take the additional step of using the `parse_block_html` option as described in the [Mix HTML + Markdown Markup section](#mix-html--markdown-markup).
You can learn more about expected usage of this approach in the [GitLab UI docs](https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-collapse--default) though the solution we use above is specific to usage in markdown.
</details>
results in:
This is the summary text, click me to expand
This is the detailed text.
We can still use markdown, but we need to take the additional step of using the parse_block_html
option as described in the Mix HTML + Markdown Markup section.
You can learn more about expected usage of this approach in the GitLab UI docs though the solution we use above is specific to usage in markdown.
The GitLab handbook also supports nested details sections.
<details>
<summary markdown="span">First level collapsible item</summary>
**Lorem ipsum dolor sit amet...**
<details>
<summary markdown="span">Second level collapsible item</summary>
*Sed ut perspiciatis unde omnis iste natus...*
</details>
</details>
results in:
First level collapsible item
**Lorem ipsum dolor sit amet...**Second level collapsible item
*Sed ut perspiciatis unde omnis iste natus...*To add a table in the collapsed heading, be sure to add:
<details markdown="1">
Code blocks
There are a few options for displaying code blocks with kramdown. Most of them use backticks `
.
In-line
This is an `in-line`
code block.
In-line
This is an in-line
code block.
Fenced
```
def hello
puts "Hello world!"
end
```
Fenced Highlighted
```ruby
def hello
puts "Hello world!"
end
```
or
```
def hello
puts "Hello world!"
end
```
{: .language-ruby}
Fenced
def hello
puts "Hello world!"
end
Fenced Highlighted
def hello
puts "Hello world!"
end
or
def hello
puts "Hello world!"
end
{: .language-ruby}
Indented
Add 4 white spaces before every line:
def hello
puts "Hello world!"
end
Indented Highlighted
def hello
puts "Hello world!"
end
{: .language-ruby}
Indented
def hello
puts "Hello world!"
end
Indented Highlighted
def hello
puts "Hello world!"
end
{: .language-ruby}
Nested
Add 4 white spaces before every line. This is used when you want to display a code block within a code block.
```
def hello
puts "Hello world!"
end
```
Nested
```
def hello
puts "Hello world!"
end
```
In lists
Indent the text of each item in 3 white spaces. Leave blank lines between the code block and the list items, and ident the code block in 5 white spaces:
1. Item 1
1. Item 2
```ruby
def hello
puts "Hello world!"
end
```
1. Item 3
-
Item 1
-
Item 2
def hello puts "Hello world!" end
-
Item 3
Blockquotes
Blockquotes are good resources to mentioning someone else’s quotes, like we did just above. Also, can be used to emphasize a sentence or a small paragraph.
> This is a blockquote.
> On multiple lines.
That may be lazy.
>
> This is the second paragraph.
----
> This is a paragraph.
>
> > A nested blockquote.
>
> ### Headers work
>
> * lists too
>
> and all other block-level **elements**.
>
> Even code blocks:
>
> def hello
> puts "Hello world!"
> end
> {: .language-ruby}
Notes
This is a regular paragraph.
**Note:** A note is something that needs to be mentioned but is apart from the context.
{: .note}
This is a regular paragraph.
Note: A note is something that needs to be mentioned but is apart from the context.
Comments
Markdown markup
This is a paragraph
{::comment}
This is a comment which is
completely ignored.
{:/comment}
... paragraph continues here.
Regular HTML markup
<!-- This is accepted as a comment too -->
{: .language-html}
This is a paragraph {::comment} This is a comment which is completely ignored. {:/comment} … paragraph continues here.
Anchors
Add an anchor anywhere with:
[](){: name="hello-world"}
Some text
Or simply use an ID:
Some text
{: #hello-world}
Font Awesome
Yes, we can use fancy (free) Font Awesome icons too.
Regular
### <i class="fas fa-puzzle-piece" aria-hidden="true"></i> Puzzle Icon
{: #puzzle}
And you can go further, such as the following.
Styled
### <i class="fab fa-gitlab fa-fw" style="color:rgb(107,79,187); font-size:.85em" aria-hidden="true"></i> Purple GitLab Tanuki
{: #tanuki-purple}
### <i class="fab fa-gitlab fa-fw" style="color:rgb(252,109,38); font-size:.85em" aria-hidden="true"></i> Orange GitLab Tanuki
{: #tanuki-orange}
When doing something like this to a heading, it’s important give it a custom ID (e.g., {: #puzzle}
),
otherwise the one automatically created by kramdown will sound very awkward.
The class fa-fw
is used when you want to display the icons as a list. They will be aligned, as well as
the text right beside them.
See live examples on this post, where the icons are used to illustrate the text.
Classes, IDs, and attributes
Defining CSS classes, and elements IDs and attributes with markdown is definitely something unusual (kramdown magic!).
But yes, if you know how to use it, you’ll love it! Check how easy it is to do that with kramdown:
Paragraph
{: .class .class-1 .class-2}
Paragraph
{: #custom-id}
Paragraph
{: .class .class-1 #custom-id-1}
## Heading
{: .class .class-1 #custom-id-2}
Paragraph
{: .class #custom-id-3 style="padding-top:0" key="value"}
## Heading {#hello}
List:
- {: .class} List item with custom class
- {:#id} List item with custom id
Paragraph {: .class .class-1 .class-2}
Paragraph {: #custom-id}
Paragraph {: .class .class-1 #custom-id-1}
Heading
{: .class .class-1 .no_toc #custom-id-2}
Paragraph {: .class #custom-id-3 style=“padding-top:0” key=“value”}
Heading
{: .no_toc}
List:
- {: .class} List item with custom class
- {:#id} List item with custom id
Special classes
Shadow
The CSS class called shadow
should be used when your image edges are not clearly defined.
This happens when it has a white background or when it’s a screenshot with text (for example,
a screenshot of our user interface). For example, this image can be mistaken as part
of the text:
Now, if you apply the class shadow
to the image, it’s discreetly highlighted from the text:
To do that, apply the class directly to the image by adding the markup `` right after the image markup:
![image alternative text](/path/to/image.png)
Note
As previously explained, you can add the class note
to paragraphs that
you don’t want to call attention to:
Note: This is something I don’t want to call attention to.
Markup:
**Note:** This is something I don't want to call attention to.
{: .note}
Colors
Add a custom class to a heading or paragraph using the following special classes.
GitLab Orange
GitLab Orange Heading
{:.gitlab-orange .no_toc}
Markup:
### GitLab Orange Heading
{: .gitlab-orange}
GitLab Purple
GitLab Purple Heading
{:.gitlab-purple .no_toc}
Markup:
### GitLab Purple Heading
{: .gitlab-purple}
Text Align
By default, the text will always be aligned to the left. You have a few options to customize it with custom classes:
- Center:
.text-center
- Right:
.text-right
- Justify:
.text-justify
For demonstrations purposes, they are aligned in an alert box, but this can be applied to regular paragraphs and headings.
Align to the center
Center-aligned {: .alert .alert-info .text-center}
Alert box markup:
Center-aligned
{: .alert .alert-info .text-center}
Paragraph markup:
Center-aligned
{: .text-center}
Heading markup:
### Center-aligned
{: .text-center}
Align to the right
Right-aligned {: .alert .alert-info .text-right}
Right-aligned
{: .alert .alert-info .text-right}
Justify
Justified {: .alert .alert-info .text-justify}
Justified
{: .alert .alert-info .text-justify}
Mix HTML + Markdown Markup
Mixing HTML markup with markdown is something almost “unthinkable” to someone used to regular markdown. And it’s all over this document!
Use the following markup at the beginning of your document:
And feel free to mix everything up:
Something in **markdown**.
<p>Then an HTML tag with crazy **markup** _all over_ the place!</p>
Something in markdown.
Then an HTML tag with crazy **markup** _all over_ the place!
You can close the markup parser tag at any point, if you want to:
{::options parse_block_html="false" /}
Mix ERB + Markdown
You may want to use Embedded Ruby (ERB) in your markdown, for example, to include a partial
. To do this, make sure your file extension is .html.md.erb
as .html.md
will not parse the Embedded Ruby.
Colorful sections
To add notes and warning blocks into colorful boxes, we are making use of Bootstrap’s panel blocks and alert boxes.
Colorful sections are applied for very specific purposes and must not be overused.
Use panels when your description contains more than one paragraph, or a long paragraph. For single and short paragraphs, use alert boxes instead.
When using panels, make sure to add the HTML parser markup to the beginning of your document’s body: ``. {: #html-parser}
Copy paste the following code according to what you want to present to the user
and replace only the description. The available colors are:
blue (info
), green (success
), amber (warning
) and red (danger
), as follows.
Additional Information
Use the following code for important notes and additional information:
<div class="panel panel-info">
**Note**
{: .panel-heading}
<div class="panel-body">
NOTE DESCRIPTION
</div>
</div>
To apply to a single paragraph, use an alert box:
My important paragraph.
{: .alert .alert-info}
Blue panels render like:
NOTE DESCRIPTION
And blue alert boxes render like:
If you want the text inside the alert box to be blue as well, we need to apply custom styles
to the markdown document. They will override the existing ones. Add the following style
tag to the end of your file.
<style>
.alert-info {
color: rgb(49,112,143) !important;
}
</style>
Warnings
Use the following code for warnings, like information that may have a different result if not used correctly:
<div class="panel panel-warning">
**Warning**
{: .panel-heading}
<div class="panel-body">
WARNING DESCRIPTION
</div>
</div>
To apply to a single paragraph, use an alert box:
My warning paragraph.
{: .alert .alert-warning}
Amber panels render like:
WARNING DESCRIPTION
And amber alert boxes render like:
If you want the text inside the alert box to be amber as well, we need to apply custom styles
to the markdown document. They will override the existing ones. Add the following style
tag to the end of your file.
<style>
.alert-warning {
color: rgb(138,109,59) !important;
}
</style>
Danger
Use the following code for crucial warnings, like commands that result in loss of data:
<div class="panel panel-danger">
**Danger**
{: .panel-heading}
<div class="panel-body">
DANGER DESCRIPTION
</div>
</div>
To apply to a single paragraph, use an alert box:
My danger paragraph.
{: .alert .alert-danger}
Red panels render like:
DANGER DESCRIPTION
And red alert boxes render like:
If you want the text inside the alert box to be red as well, we need to apply custom styles
to the markdown document. They will override the existing ones. Add the following style
tag to the end of your file.
<style>
.alert-danger {
color: rgb(169,68,66) !important;
}
</style>
Do’s and Don’ts
You can use the combination of green and red panels or alert boxes for “Do’s and Don’ts”:
<div class="panel panel-success">
**Do's**
{: .panel-heading}
<div class="panel-body">
THINGS TO DO
</div>
</div>
or, use an alert box:
TO DO.
{: .alert .alert-success}
Not to do:
<div class="panel panel-danger">
**Don'ts**
{: .panel-heading}
<div class="panel-body">
THINGS NOT TO DO
</div>
</div>
or, use an alert box:
NOT TO DO.
{: .alert .alert-danger}
By doing so, the green panels for “DO’S” will look like:
THINGS TO DO
or, if you chose an alert box:
If you want the text inside the alert box to be green as well,
we need to apply custom styles
to the markdown document. They will override the existing ones.
Add the following style
tag to the end of your file.
<style>
.alert-green {
color: rgb(60,118,61) !important;
}
</style>
And for your “DON’TS” within red panels will look like:
THINGS NOT TO DO
or, if you chose a red alert box:
Custom alert panels and alert boxes
All the previously mentioned alert boxes and panels are available by
default by Bootstrap. If we want them in a different
color, we need custom styles. At about.gitlab.com
, we
can use the orange and the purple one, as follows.
When using panels, don’t forget to add to the beginning of your file the HTML parser markup to be able to mix HMTL + Markdown: ``.
GitLab Orange Alert Panel
Text in markdown.
Panel block markup:
<div class="panel panel-gitlab-orange">
**Heading**
{: .panel-heading}
<div class="panel-body">
Text in markdown.
</div>
</div>
GitLab Orange Alert Box
Box block markup:
My text in an orange box.
{: .alert .alert-gitlab-orange}
GitLab Purple Alert Panel
Text in markdown.
Panel block markup:
<div class="panel panel-gitlab-purple">
**Heading**
{: .panel-heading}
<div class="panel-body">
Text in markdown.
</div>
</div>
GitLab Purple Alert Box
Box block markup:
My text in an purple box.
{: .alert .alert-gitlab-purple}
GitLab Webcast Alert Box
To be used in a CTA for webcast announcement in blog posts. You can use it for other purposes as well. Use it together with the HMTL parser:
The webcast I want to announce - Register here! {: .alert .alert-webcast}
<i class="fab fa-gitlab" style="color:rgb(107,79,187); font-size:.85em" aria-hidden="true"></i>
The webcast I want to announce - [Register here](#)!
<i class="fab fa-gitlab" style="color:rgb(107,79,187); font-size:.85em" aria-hidden="true"></i>
{: .alert .alert-webcast}
Styles
Yes, guess what?
This:
<style>
.purple {
color:inherit;
}
.purple:hover {
color:rgb(107,79,187);
}
</style>
Plus:
Hey! Hover the cursor over me and guess what?! :)
{: .purple}
Equals to:
Hey! Hover the cursor over me and guess what?! :) {: .purple}