Visible whitespace not visible in the HTML export

Steps to reproduce

  1. Create a Dynalist node with line breaks (as created with Ctrl + Shift + Return) and whitespace for indentation at the start of the lines. No need to add any Markdown. An example node could contain this text, shown as entered in Dynalist:

    CREATE TABLE IF NOT EXISTS data (
        id    VARCHAR NULL, 
        name  VARCHAR NULL, 
        url   VARCHAR NULL, 
        count INT NULL
    );
    
  2. Observe that the whitespace used for indentation is still visible after leaving the nodeā€™s edit mode in Dynalist. This applies even though the node is just unformatted text, not using the ``` ā€¦ ``` Markdown markup for code blocks.

  3. Export that node to HTML from the nodeā€™s context menu.

Expected result

The HTML export should also show the whitespace that was visible inside Dynalist, because the expectation is that it will look the same as much as possible. That would mean rendering these whitespace characters as   in HTML.

Actual result

The whitespace used for indentation is not visible. The HTML code does not contain any characters representing it, not even invisible normal blank characters. This applies for leading whitespace at the start of a line, and probably also for whitespace inside lines (but I did not test the latter).

I would guess adding white-space css property should fix things but Iā€™m not sure how well itā€™s supported depending on where youā€™re trying to put the HTML in, but that shouldnā€™t be too hard to fix for the general purpose HTML use case.

Unfortunately not, because the whitespace characters are missing completely from the HTML export. I checked in the HTML source.

Oh thatā€™s weird, Iā€™ll investigate why that is!

I see the spacing is in the HTML export, itā€™s just not properly shown because of HTML space collapsing. Iā€™ve added some CSS to make the spaces show up properly. If you paste into a text editor, they would show up.

Confirming that the spacing is in the HTML export. I just didnā€™t see it because in Firefox, the ā€œInspect Elementā€ mode will not show it in the source even for elements that have white-space: pre-wrap set in CSS. (I guess that could be considered a bug in Firefox. It looks different in your screenshot, so probably thatā€™s Chrome.)

Thank you for the CSS fix! :slight_smile: Couldnā€™t use it yet because now the exports donā€™t contain any CSS styling for some reason. But thatā€™s another issue that Iā€™ll report separately if I donā€™t see it reported yet.

This issue here can be considered fixed.

1 Like