Code fence lines are fully hidden in .qmd buffers unless a .md file was opened first
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- lua, neovim
Research direction
Start by reproducing the issue in Neovim with a .qmd file opened before any .md file, then compare the behavior after opening Markdown. The report points to nvim-treesitter’s Markdown highlights.scm conceal rules and notes that setting conceallevel=0 restores the fences. Find the initialization path that differs between those cases; done when fence lines remain visible in the reported .qmd startup sequence without requiring the workaround.
Written by the indexing model from the issue text.
Description
In a .qmd buffer, the opening and closing lines of a fenced code block (```python / ```) are completely hidden unless the cursor is on them. If I first open any .md file in the same session and then open the .qmd, the fence lines are shown normally (screenshots below).
Findings
- The hiding seems to come from nvim-treesitter's markdown
highlights.scm, which setsconcealandconceal_linesonfenced_code_block_delimiterand theinfo_stringlanguage. - With
set conceallevel=0the fences reappear, so it's treesitter conceal, not syntax conceal (syntaxis empty,synconcealed()returns0). - The query file used is the same in both states.
- Manually loading render-markdown.nvim in the broken state (
:Lazy load render-markdown.nvim) changes nothing, and itsfile_typesdoesn't includequarto. So opening a markdown file triggers something else that affects.qmdbuffers.
Workaround
Creating a scratch buffer with filetype=markdown once, on the first quarto FileType event, fixes it:
vim.api.nvim_create_autocmd("FileType", {
-- When opening a quarto file with quarto-nvim, first trigger a load with render-markdown to ensure its proper initialization.
-- This works around an issue where loading a quarto file before markdown results in concealed code block fences.
pattern = "quarto",
once = true,
callback = function()
local scratch = vim.api.nvim_create_buf(false, true)
vim.bo[scratch].filetype = "markdown"
vim.schedule(function()
vim.api.nvim_buf_delete(scratch, { force = true })
end)
end,
})
Steps to reproduce
- Start Neovim and open a
.qmdfile containing a Python code block. - Move the cursor off the fence lines: they disappear.
- Open any
.mdfile, then delete the.qmdbuffer and reopen it: the fences are visible.
Environment
- Neovim: 0.12.4
- OS: macOS
- Distribution: LazyVim
- quarto-nvim / nvim-treesitter / render-markdown.nvim: v2.1.0 / e289100 / 245956d
- Config:
ft = "quarto", opts = { codeRunner = { enabled = true, default_method = "molten", }, }
Screenshots
.qmd opened first
.qmd opened after .md
- Dominant language
- Lua
- Stars
- 532
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from quarto-dev/quarto-nvim
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
quarto-dev/quarto-nvim#127 · 4 reactions ·
-
waiting
Difficulty 3/5 1-2 days Newbie friendliness 35/100
quarto-dev/quarto-nvim#122 · 3 comments ·
-
enhancement waiting
Difficulty 3/5 1-2 days Newbie friendliness 25/100
quarto-dev/quarto-nvim#31 · 1 comment ·
-
add quarto-lspOpenenhancement waiting
Difficulty 5/5 Over a week Newbie friendliness 25/100
quarto-dev/quarto-nvim#13 · 3 comments · 1 reaction ·
All issues in quarto-dev/quarto-nvim
Similar issues
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
bug ready ticket
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Domktorymysli/vclu#5 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 3 days
-
Campaign WC
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
Maintainers usually reply within 1 day