Skip to content

Instantly share code, notes, and snippets.

@msurovcak
Created January 2, 2017 18:36
Show Gist options
  • Save msurovcak/65d8a2f920d8c15ada1406f0ca1b7937 to your computer and use it in GitHub Desktop.
Save msurovcak/65d8a2f920d8c15ada1406f0ca1b7937 to your computer and use it in GitHub Desktop.
Simple Sublime Text 3 Syntax File for JIRA and Confluence markup language
%YAML 1.2
---
name: JIRA and Confluence markup syntax
scope: source.atlassian-markup
license: MIT
variables:
other_text_mods: '\^|\~|\?\?'
projects: '(GD|PAAS)'
icons: '\((!|\?|/)\)'
contexts:
main:
# icons
- match: '{{icons}}'
scope: keyword.control
# *bold*
- match: '\*[^\b]+\*'
scope: markup.bold
# _italic_
- match: '_(.*)_'
scope: markup.italic
# -deleted-
- match: '\-[^\b]+\-'
scope: markup.deleted
# -inserted-
- match: '\+[^\b]+\+'
scope: markup.inserted
# {{code}}
- match: '\{\{[^\}]+\}\}'
scope: markup.raw.inline
# others (super- and -sub)
- match: '{{other_text_mods}}[^\b]?{{other_text_mods}}'
scope: markup.bold
# headings h1-5
- match: '\b^(h[0-5])(\.)'
captures:
1: keyword.control
2: default
# inline blockquote
- match: '\b^bq.'
scope: keyword.control
# lists
- match: '^[\-#\*]+ '
scope: markup.bold
# numbers
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric
# tables
- match: '(\|)(\|)?'
scope: markup.bold
# {{code}}
- match: '\{code\}'
scope: keyword.control
push: block_code
# {{quote}}
- match: '\{quote\}'
scope: keyword.control
push: block_quote
# [#anchor], [link_url], [~user]
- match: '\['
scope: keyword.control
push: anchor
# simple curly brackets
- match: '(?!\{(code|quote)\})\{'
scope: keyword.control
push: curly
- match: '\}'
scope: invalid.illegal.stray-bracket-end
# JIRA tickets
- match: '{{projects}}-[0-9]+'
scope: markup.raw.inline
curly:
- match: '\}'
scope: keyword.control
pop: true
- include: main
block_code:
- match: '^(?!\{code\}).*'
scope: markup.raw.inline
- match: '\{code\}'
scope: keyword.control
pop: true
block_quote:
- match: '^(?!\{quote\}).*'
scope: markup.italic
- match: '\{quote\}'
scope: keyword.control
pop: true
anchor:
- match: '(#|~)[^\|\]]+'
scope: markup.italic
- match: '\|'
scope: keyword.control
- match: '\]'
scope: keyword.control
pop: true
h1. Heading 1
h2. Heading 2
h3. Heading 3
h4. Heading 4
h5. Heading 5
Paragraph of a text. And this is not h1. Heading by the way.
And some more paragraphs.
bq. blockquote
{code}
kokot
{code}
{quote}
Quoted text
{quote}
{code}
Some code
code
{code}
{code}
Another code
{code}
We can define more complicated stuff pretty nicely like kg/m{^3^}.
- list item 1
- list item 2
- list item 2
(/) some
(?) little
(!) checklist
PAAS-666, GD-1234
* bullet 1
** new level
* bullet 2
# numbered item 1
# numbered item 2
## numbered sub-item 1
# Here
#* is
#* an
# example
#* of
#* a
# mixed
# list
Some paragraph with {{inline code}} and _italic_ and *strong*, also some ??citation??, -deleted-, +inserted+, ^supersript^, ~subsript~
But this is a _italic with some *bold* and -deleted- inside_ and it should nit break *another bold* or another -deleted-.
||heading 1||heading 2||heading 3||
|cell A1|cell A2|cell A3|
|cell B1|cell B2|cell B3|
[#anchor]
[~user]
[link|target]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment