-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpen Shownotes (osf).sublime-syntax
77 lines (73 loc) · 2.08 KB
/
Open Shownotes (osf).sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%YAML 1.2
---
# Open Shownotes Format Syntax Highlighting for Sublime.
#
# 2018 by Tim Pommerening
# A very simple Syntax Highlighting for Sublime and the Open Shownotes Format (osf).
# The syntax highlighting may not cover the complete OSF specification.
# It was done to fit my needs.
#
# Open Shownotes Format: https://github.com/shownotes/OpenShownotesFormat
# Syntax: See http://www.sublimetext.com/docs/3/syntax.html
# Colors: See https://github.com/cj/sublime/blob/master/Color%20Scheme%20-%20Default/Monokai.tmTheme
# name: Open Shownotes Format (osf)
file_extensions:
- osf
scope: source.osf
variables:
timecode: '^([0-9]){2}(:[0-9]{2}){2}(\.[0-9]{0,3})?'
ux_timestamp: '^[0-9]+'
chaptername: '(.*) (?=\#(c|chapter)($|\b))'
chaptertag: '(\#c(hapter)?)($|\b)'
url: '[[:word:]]+:\/\/\S+(?=>)'
placeholder_url: '.*(?=>)'
contexts:
main:
# Header
- match: '\[(/)?header\]'
scope: comment
# Timecode at Chapters
- match: '\b({{timecode}}|{{ux_timestamp}})\b(?=.*\#c)'
scope: keyword
push: chapter
# Chapter Name (for use without timecode)
- match: '{{chaptername}}'
scope: storage.type
# Chapter Tag #c
- match: '{{chaptertag}}'
scope: constant.language
pop: true
# Timecode at other entries
- match: '\b({{timecode}}|{{ux_timestamp}})\b(?=.*\#)'
scope: entity.name.class
# Other tags #other Tags
- match: '( \#[[:word:]]+)+'
scope: string
# Other tags #other Tags
- match: '( \#.*+)+'
scope: invalid
# First indention -
- match: '^(-)+ '
scope: entity.name.class
# Begin of Link
- match: '\<(?=.*?\>)'
scope: entity.name.class
push: link
chapter:
# Chapter Name
- match: '{{chaptername}}'
scope: storage.type
# Chapter Tag #c
- match: '{{chaptertag}}'
scope: constant.language
pop: true
link:
# Valid URL
- match: '{{url}}'
scope: variable.parameter
# Invalid URL (placeholder)
- match: '{{placeholder_url}}'
scope: invalid
- match: '\>'
scope: entity.name.class
pop: true