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

Line breaks (new line) are not working #241

Open
electriquo opened this issue May 4, 2023 · 8 comments
Open

Line breaks (new line) are not working #241

electriquo opened this issue May 4, 2023 · 8 comments

Comments

@electriquo
Copy link

electriquo commented May 4, 2023

Describe the bug
2 consecutive lines are being displayed in the same line, rather then in a separate lines
In some cases Slides does not honor new line as one expects, e.g. on lists.

To Reproduce
Steps to reproduce the behavior:

$ echo '
line 1
line 2
' | slides

outputs

line 1 line 2

and

echo '
- list 1

- list 2
' | slides

outputs

• list 1
• list 2

Expected behavior
A new line needs to be displayed in a new line, e.g. giving the inputs above, the outputs should look like (respectively)

line 1
line 2

and

• list 1

• list 2

Desktop (please complete the following information):

  • OS: MacOS
  • Version: 13.3.1
@hugginsio
Copy link

With regular text, the behavior you expect appears to be consistent with hard line breaks, but I found that slides does not seem to respect the two extra whitespaces or backslash methods mentioned in the GFM spec. I found an open issue for the lack of line breaks on whitespace on an upstream repo: charmbracelet/glamour#84. I found that inserting an "extra" line of whitespace worked got the desired result.

I can confirm the odd list behavior on slides 0.9.0 (Ubuntu 22.04.02). The list rendering behavior does not appear consistent with GFM - any number of empty lines between list items does not result in a line break between the two lists.

There are several issues in glamour that mention broken lists (charmbracelet/glamour#239, charmbracelet/glamour#167) but they do not seem to describe our issue here exactly. Perhaps another issue upstream is warranted?

@electriquo
Copy link
Author

@hugginsio i do not know go and don't know how to transform this issue to a glamour issue. since you know all the details, maybe you could assist doing that :)

@electriquo
Copy link
Author

@hugginsio friendly ping

@NReilingh
Copy link

Quick context note and a workaround: Be advised the reason for your initial example to not render a linebreak is that markdown is designed to allow for Semantic Line Breaks, which is why the other syntaxes for explicitly requesting hard breaks exist.

It's unfortunate that Glamour doesn't support hard break syntax yet even after a 4+ year old issue. I wanted to render a few short lines with hard breaks, so as a workaround I just wrapped the lines in triple-backticks to treat them as a code block.

@electriquo
Copy link
Author

as a workaround I just wrapped the lines in triple-backticks to treat them as a code block.

@NReilingh could you share an example?

@NReilingh
Copy link

@electriquo Try this:

```
Line one
Line two
Line three
```

It won't render anything special like bold or emphasis, but if you just want text (like an address block for example) it looks fine.

@electriquo
Copy link
Author

Thanks. That's basically just a code block, which loses most of the Markdown power.
I wish this issue will be fixed since new line so fundamental in writings.

@NReilingh
Copy link

@electriquo Same. I find it very disappointing that Glamour, a library whose only job is to render markdown in the terminal, falls so short so quickly (in my first use of Slides, I started running into glamour issues basically on line 2 of my markdown file).

Makes me wonder if a better approach would be a spec-compliant markdown to HTML converter pipelined to a terminal HTML renderer.

Don't want my disappointment to reflect badly on @maaslalani -- I'm loving every part of this project that you've put together!

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

3 participants