schemaspy / schemaspy

Database documentation built easy
http://schemaspy.org
GNU Lesser General Public License v3.0
3.22k stars 314 forks source link

Cant get line breaks in Table Comments to work. #1401

Open dmarkey opened 9 months ago

dmarkey commented 9 months ago

Expected Behavior

That I can have a line break in the output with this schema metadata

<schemaMeta xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schemaspy.org/xsd/6/schemameta.xsd" >
    <comments>Database comment</comments>
    <tables>
        <table name="usr" comments="Line \n with  \n no  \n hardbreak  \n">
            <column name="username" comments="Column comment"/>
        </table>
    </tables>
</schemaMeta>

I've tried several permutations and cant get a line break to work.

Thank you!

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

dmarkey commented 9 months ago
image
npetzall commented 9 months ago

I haven't had time yet, but it's going to pass thru markdown processing so at least two spaces are needed before the line break.

But since it's imported from the SchemaMeta I wonder if some escaping is needed. Escaping to avoid the escaping since it seems to render it as \n.

Since it goes thru markdown it might be possible with <br/> but there is a risk that it will be escaped and rendered as is.

I'll see if I get a chans to look at it today.

dmarkey commented 9 months ago

Thank you!

npetzall commented 9 months ago

Got to testing <br /> break XML syntax. The \n isn't translated correctly from XML to String in java(DocumentBuilder), so that doesn't yield the desired outcome. However DocumentBuilder translates html codes.

So to get the line breaks it's space + space +

<schemaMeta xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schemaspy.org/xsd/6/schemameta.xsd" >
    <comments>Database comment</comments>
    <tables>
        <table name="usr" comments="Line  &#10;with  &#10; no  &#10; hardbreak  \n">
            <column name="username" comments="Column comment"/>
        </table>
    </tables>
</schemaMeta>
dmarkey commented 9 months ago

Thanks!

Think we'll go the DB comment route.

Sorry slightly unrelated, do you know if there's a way to colour text?

npetzall commented 9 months ago

@dmarkey markdown doesn't have that support. We could look if the framework we use has an extension for it. But no support at the moment, the only workarounds for it are really cumbersome by adding style sheet elements to the prior to the markdown, and it's too horrible to work with, so I would suggest to avoid it.