Skip to content

Commit 5e7054d

Browse files
feat(latex): Add support for inline math
Related: #1056
1 parent c1005a0 commit 5e7054d

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

lua/orgmode/utils/treesitter/install.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local M = {
55
compilers = { 'tree-sitter', vim.fn.getenv('CC'), 'cc', 'gcc', 'clang', 'cl', 'zig' },
66
}
77

8-
local required_version = '2.0.0'
8+
local required_version = '2.0.2'
99

1010
function M.install()
1111
local version_info = M.get_version_info()

queries/org/highlights.scm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
(dynamic_block parameter: (expr) @org.block)
3333
(property_drawer (property name: (expr) @org.properties.name)) @org.properties
3434
(latex_env) @org.latex_env
35+
(inline_math_block) @org.latex
36+
(display_math_block) @org.latex
3537
(drawer) @org.drawer
3638
(tag_list) @org.tag
3739
(directive name: (expr) @_directive_name value: (value) @org.tag (#match? @_directive_name "\\c^filetags$"))

queries/org/images.scm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@
2525
(#set! injection.language "latex")
2626
(#set! image.ext "math.tex"))
2727

28+
(inline_math_block
29+
(contents) @image.content
30+
(#set! injection.language "latex")
31+
(#set! image.ext "math.tex"))
32+
33+
(display_math_block
34+
(contents) @image.content
35+
(#set! injection.language "latex")
36+
(#set! image.ext "math.tex"))

tests/plenary/colors/highlighter_spec.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,8 @@ describe('highlighter', function()
260260
[[this is \[1 + 1\] math]],
261261
[[this is \{1 + 1\} math]],
262262
})
263-
assert.are.same(3, #extmarks)
264-
assert_extmark(extmarks[1], { line = 0, start_col = 8, end_col = 17, hl_group = '@org.latex' })
265-
assert_extmark(extmarks[2], { line = 1, start_col = 8, end_col = 17, hl_group = '@org.latex' })
266-
assert_extmark(extmarks[3], { line = 2, start_col = 8, end_col = 17, hl_group = '@org.latex' })
263+
assert.are.same(1, #extmarks)
264+
assert_extmark(extmarks[1], { line = 2, start_col = 8, end_col = 17, hl_group = '@org.latex' })
267265
end)
268266
end)
269267
end)

0 commit comments

Comments
 (0)