Skip to content

Commit

Permalink
Fix parsing header with trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Feb 5, 2024
1 parent e35acb8 commit d1c8162
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added client method `Client:format_link()` for creating markdown / wiki links.

### Fixed

- Fixed parsing header with trailing whitespace (https://github.com/epwalsh/obsidian.nvim/issues/341#issuecomment-1925445271).

## [v2.9.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v2.9.0) - 2024-01-31

### Added
Expand Down
7 changes: 6 additions & 1 deletion lua/obsidian/note.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,12 @@ end
---
---@return string|?
Note._parse_header = function(line)
return line:match "^#+ (.+)$"
local header = line:match "^#+ (.+)$"
if header then
return util.strip_whitespace(header)
else
return nil
end
end

--- Get the frontmatter table to save.
Expand Down

0 comments on commit d1c8162

Please sign in to comment.