-
Notifications
You must be signed in to change notification settings - Fork 3
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
Generated html is all on a single line which makes it hard to embed code blocks in pages #12
Comments
I assume |
I actually think this is works as expected and also matches how React's JSX work. Need to include newline explicitly either via |
or use block element, e.g. |
It's related on how A few options:
In the html_of_jsx side of things, there's no information about the indentation, since it's just a DSL for HTML, and also don't expect mlx to respect it neither. |
Note that this will not work as expected. It may render correctly but if you copy/paste the code there will be no newlines in the pasted code. |
It's common to embed code snippets in web pages using html like:
I've tried to do this in a page generated with mlx:
But this generates a page where all three lines of code are concatenated on a single line:
Looking at the generated html, the reason is clear:
The html is all on a single line. My intention of using
<pre>
tags was for the line breaks in the code to be respected by the browser, and because MLX looks like html, I expected it to work the same way with regard to<pre>
tags.It's tempting to use css to treat each line of code as a block element but note that this will not work, as copy/pasted code will not include line breaks and all appear on a single line (which is kind of ironic!). My current workaround is to explicitly add a
<br/>
tag to the end of each line of code, but I would rather not have to do this.Is it possible to generate html that respects the original layout of the mlx template in terms of whitespace (at least inside
<pre>
tags)? If not, what would be the recommended way of embedding code blocks in pages generated by mlx?The text was updated successfully, but these errors were encountered: