Skip to content

Commit

Permalink
fix: hardcode markdown parser (fixes vimwiki)
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd committed Feb 27, 2024
1 parent b0e24e6 commit 0dd8bdb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lua/image/integrations/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ return document.create_document_integration({
},
query_buffer_images = function(buffer)
local buf = buffer or vim.api.nvim_get_current_buf()

local lang = vim.treesitter.language.get_lang(vim.bo[buf].filetype) or vim.bo[buf].filetype
local parser = vim.treesitter.get_parser(buf, lang)
local parser = vim.treesitter.get_parser(buf, "markdown")
parser:parse(true)
local inline_lang = "markdown_inline"
local inlines = parser:children()[inline_lang]
local inline_query = vim.treesitter.query.parse(inline_lang, "(image (link_destination) @url) @image")
local shortcut_query =
vim.treesitter.query.parse(inline_lang, "(image (image_description (shortcut_link (link_text) @url))) @image")
vim.treesitter.query.parse(inline_lang, "(image (image_description (shortcut_link (link_text) @url))) @image")

if not inlines then return {} end

Expand Down

0 comments on commit 0dd8bdb

Please sign in to comment.