reveal-md icon indicating copy to clipboard operation
reveal-md copied to clipboard

Code formatting turns exactly 12 spaces into a line break

Open detly opened this issue 2 years ago • 6 comments

reveal-md version: 6.0.1 npm version: 10.2.4 node version: v20.11.0

Create a single file test.md containing only:

```text
a            b
```

This is rendered as:

Screenshot from 2024-02-20 06-39-01

It doesn't matter what's at the start of the line, or what a and b are, or what the syntax is. It's not regular wrapping, because adding a &nbsp; halfway makes it all sit on one line. Inspecting the source shows that the text itself contains a raw line break ie. it's not a <br> in the HTML.

I was unable to reproduce this in vanilla reveal.js, but I am not super familiar with it so maybe that was just me.

detly avatar Feb 19 '24 22:02 detly

I noticed that behaviour as well, as it breaks table formatting pretty badly:

|          |                                             |
| -------- | ------------------------------------------- |
| period   | mornings (4-7 UTC) and evenings (19-23 UTC) |
| interval | 1 minute                                    |
| duration | 55 seconds                                  |
| SR       | 250 kHz (for calls up to 125 kHz)           |

renders fine on github and other markdown renderers:

period mornings (4-7 UTC) and evenings (19-23 UTC)
interval 1 minute
duration 55 seconds
SR 250 kHz (for calls up to 125 kHz)

ends up rendered by reveal-md like this:

|          |
                               |
| -------- | ------------------------------------------- |
| period   | mornings (4-7 UTC) and evenings (19-23 UTC) |
| interval | 1 minute
                      |
| duration | 55 seconds
                    |
| SR       | 250 kHz (for calls up to 125 kHz)           |

if I reduce the number consecutive spaces to <= 13, reveal-md renders the table correctly:

|          |             |
| -------- | ------------------------------------------- |
| period   | mornings (4-7 UTC) and evenings (19-23 UTC) |
| interval | 1 minute             |
| duration | 55 seconds             |
| SR       | 250 kHz (for calls up to 125 kHz)           |

cspindler avatar Mar 12 '24 11:03 cspindler

Could someone maybe try the same without reveal-md, but with only reveal.js?

webpro avatar Mar 12 '24 12:03 webpro

Tested with fresh clone of reveal.js (421da63750b3932e838efaf3bbf2c45df56f760e) and the following code:

<!-- head as seen in reveal.js repo index.html -->
<body>
  <div class="reveal">
    <div class="slides">
      <section data-markdown>
        <textarea data-template>
          |          |                                             |
          | -------- | ------------------------------------------- |
          | period   | mornings (4-7 UTC) and evenings (19-23 UTC) |
          | interval | 1 minute                                    |
          | duration | 55 seconds                                  |
          | SR       | 250 kHz (for calls up to 125 kHz)           |
        </textarea>
      </section>
    </div>
  </div>
  <script src="dist/reveal.js"></script>
<!-- rest as seen in reveal.js repo index.html -->

works as expected

cspindler avatar Mar 12 '24 12:03 cspindler

I've also hit this bug. Really weird, it breaks my tables. No errors in console.

|                 | In rust      | Tijdens verzenden | Tijdens verwerking |
| --------------- | ------------ | ----------------- | ------------------ |
| Confidentiality | Data veilig? | Data veilig?      | Data veilig?       |
| Integrity       | Data veilig? | Data veilig?      | Data veilig?       |
| Availability    | Data veilig? | Data veilig?      | Data veilig?       |

Gives

<section data-markdown="" data-markdown-parsed="true" style="top: 258.5px; display: block;" class="present"><p>|</p>
<p>| In rust      | Tijdens verzenden | Tijdens verwerking |
| --------------- | ------------ | ----------------- | ------------------ |
| Confidentiality | Data veilig? | Data veilig?      | Data veilig?       |
| Integrity       | Data veilig? | Data veilig?      | Data veilig?       |
| Availability    | Data veilig? | Data veilig?      | Data veilig?       |</p>
</section>

But with less than 12 spaces:

|  | In rust      | Tijdens verzenden | Tijdens verwerking |
| --------------- | ------------ | ----------------- | ------------------ |
| Confidentiality | Data veilig? | Data veilig?      | Data veilig?       |
| Integrity       | Data veilig? | Data veilig?      | Data veilig?       |
| Availability    | Data veilig? | Data veilig?      | Data veilig?       |

Gives

<section data-markdown="" data-markdown-parsed="true" style="top: 379.5px; display: block;" class="present"><table>
<thead>
<tr>
<th></th>
<th>In rust</th>
<th>Tijdens verzenden</th>
<th>Tijdens verwerking</th>
</tr>
</thead>
<tbody><tr>
<td>Confidentiality</td>
<td>Data veilig?</td>
<td>Data veilig?</td>
<td>Data veilig?</td>
</tr>
<tr>
<td>Integrity</td>
<td>Data veilig?</td>
<td>Data veilig?</td>
<td>Data veilig?</td>
</tr>
<tr>
<td>Availability</td>
<td>Data veilig?</td>
<td>Data veilig?</td>
<td>Data veilig?</td>
</tr>
</tbody></table>
</section>

as expected.

MartenBE avatar Aug 25 '24 21:08 MartenBE

@webpro I could (kinda) reproduce this in reveal.js, so I created an issue upstream: https://github.com/hakimel/reveal.js/issues/3671

MartenBE avatar Aug 26 '24 12:08 MartenBE

Thanks!

webpro avatar Aug 30 '24 16:08 webpro