-
Notifications
You must be signed in to change notification settings - Fork 31
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
Trouble to handle line breaks #444
Comments
Thanks for using the Markdown package. The markdown/examples/latex-pdftex.tex Lines 64 to 81 in e7c6a5b
Typeset the document by running command If you have a better idea of how the Markdown package should display HTML in PDF documents, let me know! |
Ping @michal-h21, the maintainer of TeX4ht and author of TeX4ht support in the Markdown Package for TeX, for brainstorming. |
The original code seems to be rendered fine in HTML, when compiled using
On a non-related note, I've finished my HTML parser for LuaXML. It is not on CTAN yet, but I will upload it before the TUG conference, where I will show its use. It can be used for HTML to TeX transformations, so it should be possible to use it for HTML rendering in Markdown. |
Thank you a lot @Witiko and @michal-h21 for you replies. Actually, if I may, originally I did not wanted to use HTML, and added the option only so I could use The wanted behaviour for my project is for the markdown line breaks to be "as is" in Tex. Could you indicate how I could do that ? Also thanks for indicating TeX4ht. I will make sure to explore it if I need to use more HTML features with the markdown package. For the wanted scope, it is overkill to use HTML in my project. Thank you in advance for further reply. |
You can type two or more spaces at the end of a line to write a line break: foo␣␣
baz Due to limitations of TeX, this does not work in Additionally, since Markdown 3.0.0 we also support CommonMark backslash line breaks: foo\
baz These should work both in Finally, since Markdown 3.0.0, you may also render newlines as line breaks: \markdownSetup {
renderers = {
softLineBreak = {\\},
},
}
\begin{markdown}
foo
bar
\end{markdown} Before Markdown 3.0.0, you would achieve the same result as follows: \markdownSetup { hardLineBreaks }
\begin{markdown}
foo
bar
\end{markdown} All the above examples should produce the following output:
|
That sounds awesome! 🥳 |
@Witiko Thank you again for your time I really appreciate it. Alas, it doesn't work in my environment, even before writing this issue, I tried those methods. My markdown is in a separate file: # Hello world
Lorem ipsum dolor sit amet Lorem ipsum\
dolor sit amet Lorem ipsum dolor sit amet Adding this to \markdownSetup {
renderers = {
softLineBreak = {\\},
},
} Generate and error : I wonder if I have something wrong with my work environment. Or I do not understand something ? |
Both approaches that you mentioned are only available in Markdown 3, which was only released in TeX Live 2024 a couple months ago. It's likely that you are still using an older version of the Markdown package. For older versions of the Markdown package, try changing # Hello world
Lorem ipsum dolor sit amet Lorem ipsum␣␣
dolor sit amet Lorem ipsum dolor sit amet In the above code, I used the visible space characters ( Please, do let us know if this solves your issue. 😉 |
Thank you again for your reply. So rather than just fix the issue I would prefer to update the markdown package and use the latest features. Thank you in advance for your time. |
Ubuntu and Debian are always behind the official release schedule of TeX Live by a lot. Currently, Ubuntu 22.04 LTS is 2.5 years behind, Ubuntu 23.10 is 1 year behind, and Ubuntu 24.04 LTS is a couple months behind, see packages.ubuntu.com. Ubuntu 24.04 LTS will likely receive Markdown 3 with the next update of the The easiest way to update the Markdown package is to install the latest version manually, see section Installation of the user manual. This involves no compilation, just copying files to your home directory (for the local installation) or to the directory with your document (for the portable installation). Alternatively, you can also install the latest TeX Live manually. This will allow you to keep packages up-to-date using the TeX package manager ( Finally, if you are comfortable with Docker, you can use the |
Thank you for your fast reply. I understand. The portable installation seems to be the best for me since me and some friends will be working on the documentation and everyone is on ubuntu for this project, meaning that with the portable installation, I just have to update the markdown package in our repository and everyone will be updated. I tried to follow the portable installation. But now I have errors everywhere. when compiling my Tex file. I cloned the repository, executed I tried
Thank you in advance for your time. |
The file |
I feel stupid. It's actually pretty clear, it's just my bad, I am doing 20 things at the same time and it's not efficient. It works fine, some things in my previous file is not working any more due to the update of the package, I will work on that and try my best to achieve it without taking more of your time, it should be fine. I would like to thank you a lot for the time you took to help me and your work on the markdown package. You seem to be close to the community of your work and that's rare and precious that you take the time to reply without being annoyed by people being beginner. I will not hesitate to ask for more help if I am lost. Thank you so much, I wish you the best. |
Hi, I am really new to Tex, LaTex and LuaTex.
I try to render a markdown file but it seems that HTML rendering doesn't work.
I also noticed that soft line breaks doesn't line break once rendered in Tex.
Any idea what I do wrong ?
Thanks in advance anyone.
test.tex
example.md
output:
The text was updated successfully, but these errors were encountered: