From fac05bd1e3c312ff6e19875df37d198d6e03a491 Mon Sep 17 00:00:00 2001 From: Alexandre Borela Date: Sun, 12 Mar 2017 12:50:08 -0300 Subject: [PATCH] [MD1] Add basic syntax --- syntaxes/md1/code-block.sublime-syntax | 66 +++++++++++++++++++++ syntaxes/md1/header.sublime-syntax | 81 ++++++++++++++++++++++++++ syntaxes/naomi.md1.sublime-syntax | 28 +++++++++ 3 files changed, 175 insertions(+) create mode 100644 syntaxes/md1/code-block.sublime-syntax create mode 100644 syntaxes/md1/header.sublime-syntax create mode 100644 syntaxes/naomi.md1.sublime-syntax diff --git a/syntaxes/md1/code-block.sublime-syntax b/syntaxes/md1/code-block.sublime-syntax new file mode 100644 index 00000000..acc1e710 --- /dev/null +++ b/syntaxes/md1/code-block.sublime-syntax @@ -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 diff --git a/syntaxes/md1/header.sublime-syntax b/syntaxes/md1/header.sublime-syntax new file mode 100644 index 00000000..c96a461e --- /dev/null +++ b/syntaxes/md1/header.sublime-syntax @@ -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 diff --git a/syntaxes/naomi.md1.sublime-syntax b/syntaxes/naomi.md1.sublime-syntax new file mode 100644 index 00000000..271b3105 --- /dev/null +++ b/syntaxes/naomi.md1.sublime-syntax @@ -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