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

dhall-docs: render standalone text files as preformatted text #2565

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

kukimik
Copy link
Collaborator

@kukimik kukimik commented Jan 3, 2024

I noticed that text files that are not imported by dhall files are not rendered as preformatted text, which often looks awful. See the README.md for dhall-semver:

image

The raw text looks much better: https://raw.githubusercontent.com/Gabriella439/dhall-semver/main/README.md. Moreover, displaying as preformatted text is much closer to the real contents of the file.

I can't be 100% sure, but this looks like an unintentional omission in #2407. The test didn't catch it because the Plain.txt file is imported by AsText.dhall and thus treated differently (I didn't look for the part of code responsible for this behaviour, I'm guessing based on what I see).

Side note: it's also rather easy to add support for rendering Markdown files as HTML (I have a working proof of concept, but it needs some polish). This could be nice for files like README.md, which are common in Dhall packages. On the other hand, Markdown is quite readable on its own. Anyway, that's a story for another PR.

@kukimik
Copy link
Collaborator Author

kukimik commented Jan 4, 2024

Hmm.. I don't know why the tests failed on Windows. I guess it may be LF vs CRLF inside the <pre>...</pre> block? Is there any way to see what file was generated during the tests? I don't have a machine with Windows configuration, so it's difficult for me to try it out myself.

@kukimik
Copy link
Collaborator Author

kukimik commented Jan 10, 2024

It was a \n vs \r\n (dos vs unix newlines) issue caused by git. Solved by adding a line to .gitattributes. The problem is discussed in tasty-golden docs.

@kukimik kukimik merged commit 7924082 into main Jan 11, 2024
6 checks passed
@kukimik kukimik deleted the docs-text-file-preformatted branch January 11, 2024 07:49
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

Successfully merging this pull request may close these issues.

1 participant