Skip to content

Commit

Permalink
[MD1] Add basic syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
borela committed Mar 12, 2017
1 parent 6e0d6ca commit fac05bd
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 0 deletions.
66 changes: 66 additions & 0 deletions syntaxes/md1/code-block.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
%YAML1.2
---

# Licensed under the Apache License, Version 2.0 (the “License”); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

hidden: true

scope: ...

contexts:
main:
# JSON
- match: |
(?xi)^\s*
(```JSON)
captures:
1: punctuation.delimiter.code-block.begin.md.md1
push:
- match: ^\s*(```)
captures:
1: punctuation.delimiter.code-block.end.md.md1
pop: true
- match: ""
push:
- match: (?=^\s*```)
pop: true
- include: Packages/Naomi/syntaxes/naomi.json1.sublime-syntax
- match: ""
pop: true
# JavaScript
- match: |
(?xi)^\s*
(
```
(?> EcmaScript
| ES
(?> [67]
| 201[5678]
)
| JavaScript
)
)
captures:
1: punctuation.delimiter.code-block.begin.md.md1
push:
- match: ^\s*(```)
captures:
1: punctuation.delimiter.code-block.end.md.md1
pop: true
- match: ""
push:
- match: (?=^\s*```)
pop: true
- include: Packages/Naomi/syntaxes/naomi.fjsx15.sublime-syntax
- match: ""
pop: true
81 changes: 81 additions & 0 deletions syntaxes/md1/header.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
%YAML1.2
---

# Licensed under the Apache License, Version 2.0 (the “License”); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

hidden: true

scope: ...

contexts:
main:
# Level 6.
- match: \s*(#{6})(.+$)
captures:
1: >-
level-6.md.md1
punctuation.delimiter.header.md.md1
2: >-
level-6.md.md1
entity.name.header.md.md1
pop: true
# Level 5.
- match: \s*(#{5})(.+$)
captures:
1: >-
level-5.md.md1
punctuation.delimiter.header.md.md1
2: >-
level-5.md.md1
entity.name.header.md.md1
pop: true
# Level 4.
- match: \s*(#{4})(.+$)
captures:
1: >-
level-4.md.md1
punctuation.delimiter.header.md.md1
2: >-
level-4.md.md1
entity.name.header.md.md1
pop: true
# Level 3.
- match: \s*(#{3})(.+$)
captures:
1: >-
level-3.md.md1
punctuation.delimiter.header.md.md1
2: >-
level-3.md.md1
entity.name.header.md.md1
pop: true
# Level 2.
- match: \s*(#{2})(.+$)
captures:
1: >-
level-2.md.md1
punctuation.delimiter.header.md.md1
2: >-
level-2.md.md1
entity.name.header.md.md1
pop: true
# Level 1.
- match: \s*(#{1})(.+$)
captures:
1: >-
level-1.md.md1
punctuation.delimiter.header.md.md1
2: >-
level-1.md.md1
entity.name.header.md.md1
pop: true
28 changes: 28 additions & 0 deletions syntaxes/naomi.md1.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
%YAML1.2
---

# Licensed under the Apache License, Version 2.0 (the “License”); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

name: Markdown

file_extensions:
- md

scope: text.md.md1

contexts:
main:
- match: ""
push:
- include: Packages/Naomi/syntaxes/md1/header.sublime-syntax
- include: Packages/Naomi/syntaxes/md1/code-block.sublime-syntax

0 comments on commit fac05bd

Please sign in to comment.