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

HTML in Preformatted code is rendered in docs page #496

Closed
avestura opened this issue Jun 16, 2022 · 4 comments · Fixed by #660
Closed

HTML in Preformatted code is rendered in docs page #496

avestura opened this issue Jun 16, 2022 · 4 comments · Fixed by #660
Assignees
Labels
bug Something isn't working documentation upstream Tasks blocked or to be addressed upstream

Comments

@avestura
Copy link

Even though <!-- $MDX skip --> exists on top of the pre-formatted text in documentation, the HTML is being rendered in the output.

For example:

https://github.com/ocaml/ocaml.org/blob/main/data/tutorials/lg_01_functional_programming.md?plain=1#L440-L453

This is how the markdown should look like (Github's readme screenshot):

image

This is what it looks like now (ocaml.org/docs screenshot):

image

@tmattio tmattio added bug Something isn't working documentation labels Jun 17, 2022
@tmattio
Copy link
Collaborator

tmattio commented Jun 17, 2022

Omd should probably escape the special characters when transforming the document to HTML. cc @tatchi

@tmattio tmattio added the upstream Tasks blocked or to be addressed upstream label Jun 17, 2022
@tmattio tmattio moved this to 📋 Backlog in OCaml.org Jun 21, 2022
@cuihtlauac
Copy link
Collaborator

@cuihtlauac
Copy link
Collaborator

cuihtlauac commented Nov 24, 2022

Hilite is the faulty component.

Removing highlighting removes colors and faulty behaviour

diff --git a/tool/ood-gen/lib/tutorial.ml b/tool/ood-gen/lib/tutorial.ml
index a1a4a77..fe43a66 100644
--- a/tool/ood-gen/lib/tutorial.ml
+++ b/tool/ood-gen/lib/tutorial.ml
@@ -81,7 +81,7 @@ let all () =
         category = metadata.category;
         toc_html = Omd.to_html (Omd.toc ~depth:4 toc_doc);
         body_md = body;
-        body_html = Omd.to_html (Hilite.Md.transform omd);
+        body_html = Omd.to_html omd;
       })
     "tutorials/*.md"

w/ hilite:
Screenshot_2022-11-24_11-20-31
w/o hilite:
Screenshot_2022-11-24_11-21-01

@cuihtlauac
Copy link
Collaborator

PR in Hilite: patricoferris/hilite#5

@cuihtlauac cuihtlauac self-assigned this Dec 2, 2022
@tmattio tmattio moved this from 📋 Backlog to 👀 In review in OCaml.org Dec 3, 2022
@tmattio tmattio moved this from 👀 In review to ✅ Done in OCaml.org Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation upstream Tasks blocked or to be addressed upstream
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants