Issue with markdown rendering of code blocks containing pairs of double square brackets
Summary
We have encountered a bug in markdown rendering in relation to double square brackets, specifically in Wiki pages. This is a syntax used in code in our projects, and causes us difficulty on a regular basis. The bug does not appear in Issue markdown.
Steps to reproduce
Here is some Markdown examples demonstrating the issue. In the rendering within this issue you will see the code blocks rendering as they should. If you copy this issue text into a Wiki page you will see the rendering problem.
We have an issue rendering pairs of square brackets ([[
some code
]]
) in Markdown code blocks.
[[
alone (without closing ]]
) - OK
Example 1 - Use of [[ Alone they work OK.
Example 2 - Unescaped - Fails
Here is a [[string]].
Example 3 - Escaping
Example 3.1 - Outer escaping - Fails
Here is a \[[string]\].
Example 3.2 - Both escaping - Fails
Here is a \[\[string\]\].
Example 3.3 - Inner escaping - Fails
Here is a [\[string\]].
Example 4 - In-line code
When used in in-line code the same behavior occurs: for [[example]]
.
Expected behavior
See example 2 & 4 for the expected behavior.
Actual behavior
See example 2 & 4 for the actual / failing behavior.
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.)
Output of checks
This bug happens on our own hosted GitLab server, and on GitLab.com.
Results of GitLab application Check
[04:12:39 root@########## ##########]# sudo gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...
GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
81/1 ... ok
2/5 ... ok
...snip...
481/1131 ... ok
486/1132 ... ok
5/1134 ... ok
25/1135 ... ok
1140/1136 ... ok
1143/1137 ... ok
1143/1138 ... ok
1143/1139 ... ok
5/1140 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
...snip...
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... no
Try fixing it:
sudo chown -R git /git_data/gitlab/gitlab-rails/uploads
sudo find /git_data/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
sudo find /git_data/gitlab/gitlab-rails/uploads -type d -not -path /git_data/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
For more information see:
doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
81/1 ... yes
2/5 ... yes
2/8 ... yes
...snip...
5/1134 ... yes
25/1135 ... yes
1140/1136 ... yes
1143/1137 ... yes
1143/1138 ... yes
1143/1139 ... yes
5/1140 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 734
Checking GitLab ... Finished
Results of GitLab environment info
[04:14:26 root@########## ##########]# sudo gitlab-rake gitlab:env:info
System information
System: CentOS 6.5
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.7
Rake Version: 10.5.0
Sidekiq Version:4.2.7
GitLab information
Version: 8.16.2-ee
Revision: a019470
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 9.6.1
URL: https://##########
HTTP Clone URL: https://##########/some-group/some-project.git
SSH Clone URL: git@##########:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: yes
Using Omniauth: yes
Omniauth Providers: saml, bitbucket
GitLab Shell
Version: 4.1.1
Repository storage paths:
- default: /git_data/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Possible fixes
pass.