Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 19eed57

Browse files
committed
Add math and mathblock commands
Fixes #254
1 parent dbb8576 commit 19eed57

File tree

4 files changed

+55
-29
lines changed

4 files changed

+55
-29
lines changed

lib/config.cson

+8
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ textRangeSelectBy: "nearestWord"
112112
textStyles:
113113
code:
114114
before: "`", after: "`", scopeSelector: ".raw"
115+
math:
116+
before: "$$", after: "$$", scopeSelector: ".math"
115117
bold:
116118
before: "**", after: "**", scopeSelector: ".bold"
117119
italic:
@@ -126,6 +128,12 @@ textStyles:
126128
regexBefore: "```(?:[\\w- ]+)?\\r?\\n"
127129
regexAfter: "\\r?\\n```"
128130
selectBy: "currentParagraph"
131+
mathblock:
132+
before: "$$\n"
133+
after: "\n$$"
134+
regexBefore: "\\$\\$\\r?\\n"
135+
regexAfter: "\\r?\\n\\$\\$"
136+
selectBy: "currentParagraph"
129137
deletion:
130138
before: "{--", after: "--}", scopeSelector: "critic."
131139
addition:

lib/markdown-writer.coffee

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ module.exports =
4444
editorCommands["markdown-writer:insert-#{media}"] =
4545
@registerView("./views/insert-#{media}-view")
4646

47-
["code", "codeblock", "bold", "italic", "strikethrough", "keystroke",
47+
["code", "codeblock", "math", "mathblock",
48+
"bold", "italic", "strikethrough", "keystroke",
4849
"deletion", "addition", "substitution", "comment", "highlight"
4950
].forEach (style) =>
5051
editorCommands["markdown-writer:toggle-#{style}-text"] =
5152
@registerCommand("./commands/style-text", args: style)
5253

53-
["h1", "h2", "h3", "h4", "h5", "ul", "ol", "task", "taskdone", "blockquote"].forEach (style) =>
54+
["h1", "h2", "h3", "h4", "h5", "ul", "ol",
55+
"task", "taskdone", "blockquote"].forEach (style) =>
5456
editorCommands["markdown-writer:toggle-#{style}"] =
5557
@registerCommand("./commands/style-line", args: style)
5658

menus/menu.cson

+41-27
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,11 @@
4646
'label': 'Insert Image',
4747
'command': 'markdown-writer:insert-image'
4848
}
49-
{
50-
'label': 'Insert Table',
51-
'command': 'markdown-writer:insert-table'
52-
}
5349
{
5450
'label': 'Insert Footnote',
5551
'command': 'markdown-writer:insert-footnote'
5652
}
5753
{ 'type': 'separator' }
58-
{
59-
'label': 'Code',
60-
'command': 'markdown-writer:toggle-code-text'
61-
}
62-
{
63-
'label': 'Code Block',
64-
'command': 'markdown-writer:toggle-codeblock-text'
65-
}
6654
{
6755
'label': 'Bold',
6856
'command': 'markdown-writer:toggle-bold-text'
@@ -81,24 +69,20 @@
8169
}
8270
{ 'type': 'separator' }
8371
{
84-
'label': 'deletion',
85-
'command': 'markdown-writer:toggle-deletion-text'
86-
}
87-
{
88-
'label': 'addition',
89-
'command': 'markdown-writer:toggle-addition-text'
72+
'label': 'Code',
73+
'command': 'markdown-writer:toggle-code-text'
9074
}
9175
{
92-
'label': 'substitution',
93-
'command': 'markdown-writer:toggle-substitution-text'
76+
'label': 'Code Block',
77+
'command': 'markdown-writer:toggle-codeblock-text'
9478
}
9579
{
96-
'label': 'comment',
97-
'command': 'markdown-writer:toggle-comment-text'
80+
'label': 'Math',
81+
'command': 'markdown-writer:toggle-math-text'
9882
}
9983
{
100-
'label': 'highlight',
101-
'command': 'markdown-writer:toggle-highlight-text'
84+
'label': 'Math Block',
85+
'command': 'markdown-writer:toggle-mathblock-text'
10286
}
10387
{ 'type': 'separator' }
10488
{
@@ -135,7 +119,7 @@
135119
'command': 'markdown-writer:toggle-task'
136120
}
137121
{
138-
'label': 'Task List (Done)'
122+
'label': 'Toggle Task List'
139123
'command': 'markdown-writer:toggle-taskdone'
140124
}
141125
{ 'type': 'separator' }
@@ -145,9 +129,38 @@
145129
}
146130
]
147131
}
132+
{
133+
'label': 'CriticMarkup'
134+
'submenu': [
135+
{
136+
'label': 'Addition',
137+
'command': 'markdown-writer:toggle-addition-text'
138+
}
139+
{
140+
'label': 'Deletion',
141+
'command': 'markdown-writer:toggle-deletion-text'
142+
}
143+
{
144+
'label': 'Substitution',
145+
'command': 'markdown-writer:toggle-substitution-text'
146+
}
147+
{
148+
'label': 'Comment',
149+
'command': 'markdown-writer:toggle-comment-text'
150+
}
151+
{
152+
'label': 'Highlight',
153+
'command': 'markdown-writer:toggle-highlight-text'
154+
}
155+
]
156+
}
148157
{
149158
'label': 'Table'
150159
'submenu': [
160+
{
161+
'label': 'Insert Table',
162+
'command': 'markdown-writer:insert-table'
163+
}
151164
{
152165
'label': 'Format Table'
153166
'command': 'markdown-writer:format-table'
@@ -166,6 +179,7 @@
166179
'label': 'Fold All Links'
167180
'command': 'markdown-writer:fold-links'
168181
}
182+
{ 'type': 'separator' }
169183
{
170184
'label': 'Unfold All'
171185
'command': 'editor:unfold-all'
@@ -190,8 +204,8 @@
190204
}
191205
{ 'type': 'separator' }
192206
{
193-
'label': 'Fold All Links'
194-
'command': 'markdown-writer:fold-links'
207+
'label': 'Format Ordered List'
208+
'command': 'markdown-writer:format-order-list'
195209
}
196210
{ 'type': 'separator' }
197211
{

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"markdown-writer:insert-table",
3939
"markdown-writer:toggle-code-text",
4040
"markdown-writer:toggle-codeblock-text",
41+
"markdown-writer:toggle-math-text",
42+
"markdown-writer:toggle-mathblock-text",
4143
"markdown-writer:toggle-bold-text",
4244
"markdown-writer:toggle-italic-text",
4345
"markdown-writer:toggle-keystroke-text",

0 commit comments

Comments
 (0)