PacoVK / antora-confluence

Plugin to publish your Antora docs to Confluence
Apache License 2.0
12 stars 3 forks source link

Improve xml source code blocks display #30

Open TitouanM opened 2 months ago

TitouanM commented 2 months ago

Hello

In an adoc file, I have a block of code :

[source,xml]

< ?xml version="1.0" encoding="UTF-8"?> < Personne> < champ1> < champ2>something cool< /champ2> < /champ1> < /Personne>

Is it possible to improve the rendering please ?

Actually, the rendering is : & lt;?xml version="1.0" encoding="UTF-8"?& gt; & lt;Personne& gt; & lt;champ1& gt; & lt;champ2>comething cool& lt;/champ2> & lt;/champ1& gt; & lt;/Personne& gt;

Thanks

PacoVK commented 2 months ago

I assume you want to have a pretty formatted rendering here?

TitouanM commented 2 months ago

Whooops sorry the code blocks and the "& lt;" had been transformed by the editor ! I edited my first message !

PacoVK commented 2 months ago

Thanks for bringing this up, i am working on a fix and will try to release soon :)

TitouanM commented 1 month ago

Thx a lot for your reactivity. Do you know when will be the next release please ?

PacoVK commented 1 month ago

I just released 0.3.1 :)

TitouanM commented 1 month ago

I just tried the new release. I have a new issue but I don't know if you want a new ticket or just to continue here. Feel free to let me know ;)

In a page, I have a table :

== My table 
|===
|Header 1 | Header 2 | Header 3
|Item 1 |X |X
|Item 2 |  | X
|Item 3 |  | X

The HTML generation gives :

<h2 id="_mytable"><a class="anchor" href="#_mytable"></a>My Table</h2>
<div class="sectionbody">
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Header 1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Header 2</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Header 3</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Item 1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">X</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">X</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Item 2</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">X</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Item 3</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">X</p></td>
</tr>

</tbody>
</table>

In the end, the antora-confluence part leads to the following error :

warn:     Publish failed with response 400
warn:     {"statusCode":400,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"Error parsing xhtml: Unexpected close tag </colgroup>; expected </col>.\n at [row,col {unknown-source}]: [21,440]","reason":"Bad Request"}
error: undefined
[16:14:07.443] FATAL (antora): Cannot destructure property 'id' of '(intermediate value)' as it is undefined.
    Cause: TypeError

Seems like it is waiting a but there is no need.

Can you have a look at it please ?

PacoVK commented 1 month ago

Thanks for the quick feedback, unfortunately i oversaw that i was missing a setting to ensure closed tags. I just released 0.3.2 for that

TitouanM commented 1 month ago

Thanks for your fast reaction ! Unfortunately, I have a new error with release 0.3.2 that I did not have in 0.3.0 :

Error parsing xhtml: Unexpected character '>' (code 62) in content after '<' (malformed start element?)

For the moment, I did'nt find the source of this error....

PacoVK commented 4 weeks ago

@TitouanM i fail to reproduce it. So far i tried to reproduce with the following example:

= System Scope and Context
:plantuml-server-url: http://plantuml.com/plantuml

[.helptext]
****
.Contents
System scope and context - as the name suggests - delimits your system (i.e. your scope) from all its communication partners
(neighboring systems and users, i.e. the context of your system). It thereby specifies the external interfaces.

If necessary, differentiate the business context (domain specific inputs and outputs) from the technical context (channels, protocols, hardware).

.Motivation
The domain interfaces and technical interfaces to communication partners are among your system's most critical aspects. Make sure that you completely understand them.

.Form
Various options:

* Context diagrams
* Lists of communication partners and their interfaces.
****

== Business Context

[source,xml]
< ?xml version="1.0" encoding="UTF-8"?>
< Personne>
< champ1>
< champ2>something cooddd< /champ2>
< /champ1>
< /Personne>

[.helptext]
****
.Contents
Specification of *all* communication partners (users, IT-systems, ...) with explanations of domain specific inputs and outputs or interfaces.
Optionally you can add domain specific formats or communication protocols.

.Motivation
All stakeholders should understand which data are exchanged with the environment of the system.

.Form
All kinds of diagrams that show the system as a black box and specify the domain interfaces to communication partners.

Alternatively (or additionally) you can use a table.
The title of the table is the name of your system, the three columns contain the name of the communication partner, the inputs, and the outputs.
****

No error and it renders the XML nicely in my Confluence Cloud instance i have