kovetskiy / mark

Sync your markdown files with Confluence pages.
https://samizdat.dev
Other
972 stars 143 forks source link

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

Open monti-python opened 3 weeks ago

monti-python commented 3 weeks ago

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} -->

2. Create the following file `test.md`

:children:

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

:children:


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

Further Information (please complete the following information)