Skip to content

Commit

Permalink
Require spaces to create callout block markers
Browse files Browse the repository at this point in the history
  • Loading branch information
aquilesg committed Jul 30, 2024
1 parent fd6a777 commit 2dcd6ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lua/obsidian/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ M.Patterns = {

-- Miscellaneous
Highlight = "==[^=]+==", -- ==text==
Callout = "%[!.*%]",
Callout = ">+ %[!.*%]",

-- References
WikiWithAlias = "%[%[[^][%|]+%|[^%]]+%]%]", -- [[xxx|yyy]]
Expand Down
6 changes: 3 additions & 3 deletions lua/obsidian/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ end
---@param callout_word string
local function generate_callout_extmarks_header(marks, indent, line, lnum, opts, callout_hl_group_stack, callout_word)
-- Process the > marks leading up to the header
local callout_mark_start_pattern = "[%!%[]"
local callout_mark_start_pattern = "> %[%!%[]"
local callout_mark_end_pattern = "%]"

-- Conceal the callout mark
Expand Down Expand Up @@ -593,15 +593,15 @@ local function get_callout_extmarks(marks, line, lnum, ui_opts, callout_hl_group
if string.match(line, search.Patterns.Callout) then
-- Process if current line is a callout mark
for calloutWord, opts in pairs(ui_opts.callouts) do
local constructed_text = "[!" .. string.lower(calloutWord) .. "]"
local constructed_text = "> [!" .. string.lower(calloutWord) .. "]"
if string.find(lower_line, constructed_text, 1, true) then
log.debug("Generating callout header for" .. calloutWord)
generate_callout_extmarks_header(marks, indent, line, lnum, opts, callout_hl_group_stack, calloutWord)
break
end

for _, alias in ipairs(opts.aliases) do
local alias_constructed_text = "[!" .. string.lower(alias) .. "]"
local alias_constructed_text = "> [!" .. string.lower(alias) .. "]"
if string.find(lower_line, alias_constructed_text, 1, true) then
log.debug("Generating callout header for" .. alias)
generate_callout_extmarks_header(marks, indent, line, lnum, opts, callout_hl_group_stack, alias)
Expand Down

0 comments on commit 2dcd6ca

Please sign in to comment.