Skip to content

Commit

Permalink
fix another YAML parser bug
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Apr 1, 2024
1 parent 30a7d7b commit 3c3656b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/obsidian/yaml/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Parser._parse_inline_array = function(self, i, text)
if vim.endswith(str, "]") then
str = string.sub(str, 1, -2)
else
return false, self:_error_msg("invalid inline array", i, text), nil
return false, nil, nil
end

local out = {}
Expand Down
8 changes: 8 additions & 0 deletions test/obsidian/yaml/parser_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,12 @@ describe("Parser class", function()
}, "\n"))
assert.are_same({ tags = { "#demo" } }, result)
end)

it("should parse array item strings that look like markdown links", function()
local result = parser:parse(table.concat({
"links:",
" - [Foo](bar)",
}, "\n"))
assert.are_same({ links = { "[Foo](bar)" } }, result)
end)
end)

0 comments on commit 3c3656b

Please sign in to comment.