-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjournal.sublime-syntax
More file actions
99 lines (91 loc) · 2.27 KB
/
journal.sublime-syntax
File metadata and controls
99 lines (91 loc) · 2.27 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
%YAML 1.2
---
# Copyright © 2025 Mathijs Lagerberg
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the COPYING file for more details.
name: Journal
file_extensions: [txt,journal.txt]
scope: text.journal
contexts:
main:
# Titles
- match: '(===)\s(.*)\s(===)'
scope: markup.heading
captures:
1: keyword.control
3: keyword.control
# Markdown-style titles
- match: '(#+)\s(.*)'
scope: markup.heading
captures:
1: keyword.control
# Dates. Line starts with % and matches until a - (with space) or newline
- match: '^%[^\n]*?(?= -|$)'
scope: constant.numeric
push: start_of_day
# Week separator
- match: '^-{3,}$'
scope: markup.deleted
# Mood tracking (Mood: excited)
- match: '>\s+(.*)'
scope: string.quoted
# Top separator
- match: '^=+$'
scope: markup.inserted
# Body texxt can include inline highlights
- include: body_text
start_of_day:
- meta_scope: markup.bold
- match: '\-'
push: day_label
- match: $
pop: true
day_label:
- meta_scope: markup.italic
- include: timestamp
- include: name
- include: hashtag
- match: $
pop: true
pop_eol:
- match: $
pop: true
# Body text is not task-related, but copies a few
# Markdown features for convenience. And timestamps.
body_text:
- include: quote
- include: timestamp
- include: inline_code
- include: urls
- include: bold
- include: italic
- include: name
- include: hashtag
quote:
- match: '^\s*>'
scope: comment.line
timestamp:
- match: '[0-9]{1,2}:[0-9]{2}(\s*-\s*[0-9]{1,2}:[0-9]{2})?'
scope: variable.function
inline_code:
- match: '(`)(.*)(`)'
scope: markup.raw
captures:
1: keyword.control
3: keyword.control
bold:
- match: '\*.*\*'
scope: markup.bold
italic:
- match: '_.*_'
scope: variable.language
urls:
- match: '[^\s]+://[^\s]+'
scope: markup.underline.link
name:
- match: '@[a-zA-Z0-9]+'
scope: variable.language.python
hashtag:
- match: '#[a-zA-Z0-9]+'
scope: comment.line.