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

Docs: improve rendering of markdown READMEs #612

Closed
MisterDA opened this issue Oct 20, 2022 · 3 comments
Closed

Docs: improve rendering of markdown READMEs #612

MisterDA opened this issue Oct 20, 2022 · 3 comments
Labels
bug Something isn't working package Improvements or additions to the package documentation upstream Tasks blocked or to be addressed upstream

Comments

@MisterDA
Copy link
Contributor

Hi all,
I've noticed a couple of issues with the way markdown READMEs are rendered. Most of the packages are hosted on GitHub, so I think it makes sense to mimic as much as possible how GitHub renders them, for consistency.

Let's have a look at how the alcotest-lwt package overview is rendered.

GFM is the name of the GitHub Flavored Markdown dialect.

  1. Hard breaks vs soft breaks

    When rendering Markdown, inside a single block of text you can consider each line ending to be a hard-break and render the paragraph line by line, or render the whole paragraph as a single <p> block and concatenate the lines. GFM does the former for comments (issues, PRs, …) but the latter for text documents (READMEs). The result is that people don't care if their README is self-consistent with respect to column length of each paragraph line since GFM concatenates each line. The result is that the overview page has some paragraphs running at 70, 80, or 90 columns.

    My opinion is that the renderer should not consider line breaks inside a paragraph.
    GFM allows ending a line with two spaces to insert a hard break (but this is unpractical since some editors remove trailing whitespace) or (iirc) a backslash.

  2. URL is counted as part of the line

    As line breaks are hard breaks, if one puts a link in the long form in a paragraph [example](https://example.com/a/very/long/url) they'll tend to insert a new line after. This leads to weird rendering.

    2022-10-20-13:57:56
    2022-10-20-13:58:06

  3. Backticks rendered for inline-code

    For inline code, GitHub (and as far as I can tell, no one) renders the backtick. They are rendered in the docs website (but not as part of selectable text content, which is good). I personally highly dislike seeing them, I think they're part of markup and should not appear in rendered content.

    Anyway: if you want to have a backtick as part of inline code, you have to start the inline code with two backticks followed by a space, then your code, then two closing backticks. This can happen with OCaml code with polymorphic variants. Alcotest thus has this confusing text rendered:

    2022-10-20-14:06:31
    or
    2022-10-20-14:06:49
    Please consider not displaying these backticks.

  4. Code is not syntactically highlighted

    Even though code blocks have the ocaml language tag, they're not syntactically highlighted. It would be nice to have colors!

Thanks!

@cuihtlauac
Copy link
Collaborator

Hi @MisterDA, thanks for reporting this. I believe you're right, items 1 to 3 are bugs indeed.

@cuihtlauac cuihtlauac added the bug Something isn't working label Nov 2, 2022
@tmattio tmattio added the upstream Tasks blocked or to be addressed upstream label Nov 14, 2022
cuihtlauac pushed a commit that referenced this issue Nov 14, 2022
By default taiwind css surounds inline code with backticks. In
order to have a more GitHub-like experience, as suggested by
@MisterDA in #612 the
tailwind configuration needs to be changed as explained here:

tailwindlabs/tailwindcss-typography#18
@cuihtlauac
Copy link
Collaborator

Item #3 is not an upstream issue. The CSS is faulty. This PR fixes the issue: #625

tmattio added a commit that referenced this issue Nov 15, 2022
* Remove backticks around inline code fragments

By default, TailwindCSS surrounds inline code with backticks. In
order to have a more GitHub-like experience, as suggested by
@MisterDA in #612 the
tailwind configuration needs to be changed as explained here:

tailwindlabs/tailwindcss-typography#18

Co-authored-by: Cuihtlauac ALVARADO <[email protected]>
Co-authored-by: Thibaut Mattio <[email protected]>
@cuihtlauac cuihtlauac added the package Improvements or additions to the package documentation label Dec 7, 2022
@sabine
Copy link
Collaborator

sabine commented Feb 28, 2024

Hard breaks in README have been fixed by ocaml-doc/voodoo#119.

Opened a separate issue upstream for the missing syntax highlighting at ocaml-doc/voodoo#140. Closing this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package Improvements or additions to the package documentation upstream Tasks blocked or to be addressed upstream
Projects
Archived in project
Development

No branches or pull requests

4 participants