Open cabidop opened 5 months ago
Good point, the extraction logic should probably be part of the custom parser and not be done via a regular expression.
Hey @mrueg, not fully sure of what the solution you proposed implies (moving the extraction to the custom parser) but a quick fix could be to just update the regex to better fit the Markdown specification for headings. Something like this should do the job (I can open a PR to add the change together with some tests): ^\s{0,3}#\s+(.*)(\s+#+)?\s*\n
What happened?
When trying to use inline template macros with the
--title-from-h1
parameter, instead of using the leading H1 header for the Confluence page titlemark
is using the template name of the first macro minus its first character (i.e. if the first inline template is defined asTemplate: #my_template
the Confluence title becomesy_template
).What did you expect to happen?
The Confluence title matches the actual leading H1 header.
How can we reproduce the behavior you experienced?
--title-from-h1
parameter.<!-- Title -->
header and at least one<!-- Macro -->
header with an inline template defined.Minimal markdown example where the Confluence title becomes
nline
instead ofSome title
:Information (please complete the following information)
mark --version
): v9.11.1--title-from-h1
Logs or other output
No relevant logs that might highlight or help debugging the issue.
Additional context
Looks like the regex used in the
ExtractDocumentLeadingH1
function might be the culprit, as it does match the observed behaviour.