Open mrueg opened 1 year ago
I believe the problem is that we're treating
@bernd (you might have some thoughts here as you added https://github.com/kovetskiy/mark/pull/270) @kovetskiy any thoughts on how to achieve this?
I tried working with a block parser, unfortunately it will add new <p>
paragraph tags all the time, which breaks rendering.
@mrueg Can you share your block parser code?
@bernd https://github.com/mrueg/mark/commit/e409fb7351760237ebb00b6936ed7ba2f292b130 this was my attempt but it does not work, as the closing ones after the table will create a new paragraph. I'm not sure if I need to use a paragraph transformer for that.
@mrueg I spent a little time looking at this - I'm not sure if the inline parser is the issue. It looks like the <ac:rich-text>
and </ac:rich-text>
tags are each parsed as ast.RawHTML
nodes, and should be the preceding and following siblings of the table.
FWIW, I think that actually may be a legit rendering of that markdown - GFM tables, I think, need to start their line. If you put a \n
before the |
it seems to work.
e.g.
Thanks for taking a look, I made a mistake in the initial description, hope this makes it more clear:
The problem is that the RawHTML gets encapsulated in a paragraph
<p><ac:structured-macro ac:name="info">
<ac:parameter ac:name="icon">true</ac:parameter>
<ac:parameter ac:name="title">Attention</ac:parameter>
<ac:rich-text-body></p>
then the table follows and the closing tags are encapsulated in its own paragraph.
<p></ac:rich-text-body>
</ac:structured-macro></p>
A similar example which I think shows some inconsistency in how inline macros work. There are two pairs of macros, the first is the tblbox macro from the project's README and the second is my attempt to create an infobox macro.
<!-- Space: space -->
<!-- Parent: parent -->
<!-- Title: title -->
<!-- Macro: <tblbox\s+(.*?)\s*>
Template: #inline
title: ${1}
inline: |
<table>
<thead><tr><th>{{ .title }}</th></tr></thead>
<tbody><tr><td>
-->
<!-- Macro: </tblbox>
Template: #also_inline
also_inline: |
</td></tr></tbody></table>
-->
<!-- Macro: <infobox\s+(.*?)\s*>
Template: #inline
title: ${1}
inline: |
<ac:structured-macro ac:name="info" ac:schema-version="1">
<ac:parameter ac:name="title">{{ .title }}</ac:parameter>
<ac:rich-text-body>
-->
<!-- Macro: </infobox>
Template: #also_inline
also_inline: |
</ac:rich-text-body></ac:structured-macro>
-->
<tblbox with a title>
and some
content
</tblbox>
<infobox info title>
and some
content
</infobox>
Which when rendered produces...
<table>
<thead><tr><th>with a title</th></tr></thead>
<tbody><tr><td>
<p>and some
content</p>
</td></tr></tbody></table>
<p><ac:structured-macro ac:name="info" ac:schema-version="1">
<ac:parameter ac:name="title">info title</ac:parameter>
<ac:rich-text-body></p>
<p>and some
content
</ac:rich-text-body></ac:structured-macro></p>
So tblbox
is rendered as we'd expect but infobox
which is not hugely different has each macro's output wrapped in <p>
s.
I'm struggling with the same problem. Does anybody have a solution for using <ac:*>
blocks (in templates)?
What happened? Trying to render this to confluence
results in
What did you expect to happen? Table gets rendered
How can we reproduce the behavior you experienced? Steps to reproduce the behavior:
In case this is related to specific markdown, please provide a minimal markdown example here.
Information (please complete the following information):
mark --version
): [e.g. v9.1.4] 9.5.2Logs or other output Please provide logs, other kind of output or observed metrics here.
Additional context Add any other context about the problem here.