mark icon indicating copy to clipboard operation
mark copied to clipboard

Include header doesn't work when placed right after title header

Open monti-python opened this issue 1 year ago • 1 comments

What happened?

Adding an Include header right after a Title header doesn't work, e.g:

<!-- Title: Test -->
<!-- Include: macros.md -->

:children:

The only way to solve it to add an additional newline between both headers

What did you expect to happen?

The include statement above should work

How can we reproduce the behavior you experienced?

  1. Create the following file macros.md
<!-- Macro: :box:([^:]+):([^:]*):([^:][\s\S]*?):
    Template: ac:box
    Icon: true
    Name: ${1}
    Title: ${2}
    Body: ${3} -->

<!-- Macro: :children:
    Template: ac:children
-->

<!-- Macro: :updated:
    Template: ac:recently-updated
-->
  1. Create the following file test.md
<!-- Title: Test -->
<!-- Include: macros.md -->

:children:
  1. Export your mark params env vars (MARK_BASE_URL, MARK_SPACE, MARK_USERNAME, MARK_PASSWORD)
  2. Run mark -f test.md --include-path "." --dry-run --debug
  3. You should get the below compiled HTML (wrong output):
<p>:children:</p>
  1. Now add a newline between the title and include headers in the previous file test.md:
<!-- Title: Test -->

<!-- Include: macros.md -->

:children:
  1. If you run step 4 again, now you get the right output:
<p><ac:structured-macro ac:name="children"></ac:structured-macro></p>

Further Information (please complete the following information)

  • Mark Version (mark --version): 9.12.0
  • Mark Parameters: No additional params
  • Confluence Hosting: Datacenter
  • Confluence Version: N/A
  • Environment specific Information: Ubuntu/WSL

monti-python avatar Jun 12 '24 21:06 monti-python

Yeah it looks like when it's part of the header, it gets ignored here: https://github.com/kovetskiy/mark/blob/fad9866b416256415a13ad4daf338c8c7347ef2a/pkg/mark/meta.go#L114 probably rather should call ProcessIncludes and feed them back into the file.

mrueg avatar Jul 30 '24 11:07 mrueg