Skip to content

Commit

Permalink
test: add minimal example for markdown
Browse files Browse the repository at this point in the history
refer: #2874, #2978
  • Loading branch information
lervag committed Jul 12, 2024
1 parent fdb5618 commit 80c9bc1
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ test/test-compiler/latexrun
test/test-syntax/syntax/
test/test-textobj-targets/targets.vim/
test/issues
test/test-completion-bibtex/test_parser_*
test/test-quickfix-fix-path/test_hbox*

*.log
12 changes: 12 additions & 0 deletions test/example-markdown/after/syntax/markdown.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if exists('b:_loaded_markdown_vimtex')
finish
endif
let b:_loaded_markdown_vimtex = 1

unlet b:current_syntax
syntax include @tex syntax/tex.vim
let b:current_syntax = 'markdown'

syntax region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
syntax region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
syntax region mkdMath start="\\\@<!\\(" end="\\\@<!\\)" contains=@tex keepend
16 changes: 16 additions & 0 deletions test/example-markdown/syntax/markdown.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if exists('b:_loaded_markdown_vimtex')
finish
endif
let b:_loaded_markdown_vimtex = 1

if !exists('b:current_syntax')
runtime! syntax/markdown.vim
endif

unlet! b:current_syntax
syntax include @tex syntax/tex.vim
let b:current_syntax = 'markdown'

syntax region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
syntax region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
syntax region mkdMath start="\\\@<!\\(" end="\\\@<!\\)" contains=@tex keepend
31 changes: 31 additions & 0 deletions test/example-markdown/test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
vim.opt.runtimepath:prepend "~/.local/plugged/vimtex"
vim.opt.runtimepath:append "~/.local/plugged/vimtex/after"
-- vim.opt.runtimepath:prepend "."
vim.opt.runtimepath:append "./after"

vim.cmd [[filetype plugin indent on]]
vim.cmd [[syntax enable]]

vim.keymap.set("n", "q", "<cmd>qall!<cr>")

vim.g.vimtex_cache_root = "."
vim.g.vimtex_cache_persistent = false

vim.cmd.colorscheme "morning"

vim.api.nvim_set_hl(0, "Conceal", { bg = "NONE", fg = "blue" })
vim.api.nvim_set_hl(0, "texCmdRef", { fg = "cyan" })

local au_group = vim.api.nvim_create_augroup("init", {})
vim.api.nvim_create_autocmd("CursorMoved", {
pattern = "*",
group = au_group,
command = [[echo join(vimtex#syntax#stack(), ' -> ')]],
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
group = au_group,
command = [[call vimtex#init()]],
})

vim.cmd.edit "test.md"
7 changes: 7 additions & 0 deletions test/example-markdown/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Title

math here $f(x) = 1$

math here \(f(x) = 1\)

**bold text** _italic text_
1 change: 0 additions & 1 deletion test/perf-syntax/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion test/test-completion-bibtex/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion test/test-quickfix-fix-path/.gitignore

This file was deleted.

0 comments on commit 80c9bc1

Please sign in to comment.