Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code formatting turns exactly 12 spaces into a line break #476

Open
detly opened this issue Feb 19, 2024 · 6 comments
Open

Code formatting turns exactly 12 spaces into a line break #476

detly opened this issue Feb 19, 2024 · 6 comments

Comments

@detly
Copy link

detly commented Feb 19, 2024

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.

@cspindler
Copy link

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)           |

@webpro
Copy link
Owner

webpro commented Mar 12, 2024

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

@cspindler
Copy link

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

@MartenBE
Copy link
Contributor

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
Copy link
Contributor

MartenBE commented Aug 26, 2024

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

@webpro
Copy link
Owner

webpro commented Aug 30, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants