Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Title not being extracted when not on the first line
While a page with a macro is processed, having a macro leaves an unclean buffer for further processing steps, including title extraction. The problem seems to come from `ExtractMeta`: as it runs through the metadata, it hits the first line of the macro but since it doesn't look like a complete Metadata (e.g. matching either `\[\]:\s*#\s*\(([^:]+):\s*(.*)\)` or `<!--\s*([^:]+):\s*(.*)\s*-->` in https://github.com/kovetskiy/mark/blob/master/pkg/mark/meta.go#L37:L38, it will break the loop in https://github.com/kovetskiy/mark/blob/master/pkg/mark/meta.go#L61 and return the final document as: ``` Template: ac:children Style: h2 Excerpt: none Page: TestSpace:Test Reverse: false All: true --> :children: ``` This then goes into `ExtractDocumentLeadingH1` which doesn't find a match for the regex `^#[^#]\s*(.*)\s*\n`, returning an empty title since the title is not on the first line. This commit, while it doesn't fix the unclean document, fixes the regex to properly find the title. Closes kovetskiy#214
- Loading branch information