OpenWaterFoundation / owf-app-infomapper-ng

Open Water Foundation InfoMapper web application for menu-driven maps and visualizations, using Angular
GNU General Public License v3.0
1 stars 2 forks source link

Showdown styling results in bad paragraph wrap #374

Closed smalers closed 3 years ago

smalers commented 3 years ago

The latest InfoMapper (2.0.0) Markdown viewer seems to not align paragraphs well. I think this issue was fixed previously. Maybe the new library code is not including the necessary CSS? Below is an example of the bad alignment. The introduction should not have such odd right edge.

image

Nightsphere commented 3 years ago

The new commit has been merged. This seemed to be an issue with the top level app.module.ts file Showdown import not containing the necessary simpleLineBreaks property. When simpleLineBreaks is set to true, it adds in a <br> tag in the HTML, so each newline in the supplied markdown file will be a newline in the converted showdown.

In the Showdown documentation, it claims that the default setting for this property is false, but if it is not in the converter configuration object, it seems to be set to true. Adding simpleLineBreaks to the object set to false is solving the issue.

However, making sure that a user adds this to the top level config object can be skipped by just telling each converter instance what to do with its own options. These smaller scoped option config objects override the top level if they contain the same property. If the top level config object contains the extensions property and a component config object does not, then the extensions will still exist in the component object. If both contain the simpleLineBreaks property, then whatever the component property is set to will be used.

To be safe, the InfoMapper will set both simpleLineBreaks to false, but if another application is created, or if the top level simpleLineBreaks property is removed, it won't effect the component converter anymore. Since this specific issue deals with the common library, I've decided to create the Dialog Documentation Component's config object myself, effectively overriding 8 properties so that a user can't change them. I've gone ahead with this because I believe that these would overwhelmingly be used as is, such as setting the option to show tables, use strikethrough, enables emojis, etc.

This includes the simpleLineBreaks. This way, a newline is only added to the HTML if it detects two or more newlines in the markdown file. Closing the issue.