qibogang / qibogang.github.io

The gang site :)
https://qibogang.github.io
0 stars 0 forks source link

Some experiments with markdowns #15

Closed MatteoRobbiati closed 1 year ago

MatteoRobbiati commented 1 year ago

With this PR I present a new method for highlighting the *.mdx files. I am using a react module called SyntaxHighlighter, which must be used inside the markdown writing. It seems to be more beautiful than the previous output.

A remaining problem for displaying the tutorials is the #14.

MatteoRobbiati commented 1 year ago

Presenting the current markdown status

With the most recent push I have uploaded a working solution for the markdown rendering. Here we use some plugins for styling the code and the math formulas; in particular rehype-katex, remark-math and rehype-highlight.

In order to show you how it appears, here we have the math's rendering:

math

and here the code's rendering:

code

These two solutions are implemented without needing to use any react component into the markdown file. This means that at this point a standard *.mdx file is correctly fetched and rendered in the procedure written into pages/tutorials/[slug].js. This is useful in order to provide people with a simple tool while contributing.

Some open issues

Mathematical formulas are not perfect yet (you can see some errors in the rendering). I have to understand how to write properly math into the markdown and, once understood, I will write a CONTRIBUTE.md file in which I want to explain all the "proper manners" for contributions.

What do you think about this?

alecandido commented 1 year ago

I will review this late on today, but it looks good enough :)

MatteoRobbiati commented 1 year ago

Sorry for the many messages!

Now also LaTeX is fixed: I removed all the extra \ from the markdown and now all is good. This is because the plugins don't need any help to render LaTeX (they are created for that).

alecandido commented 1 year ago

There are still leftover comments also from the old review

MatteoRobbiati commented 1 year ago

There are still leftover comments also from the old review

Thank you very much for the reviews. I'll try to fix all step by step.

MatteoRobbiati commented 1 year ago

@AleCandido I think that all the modifications are done. There are some things to be fixed again (remark-gfm, the extensions and some cleanings must be done). But I think that this shape is workinig.

alecandido commented 1 year ago

@AleCandido I think that all the modifications are done. There are some things to be fixed again (remark-gfm, the extensions and some cleanings must be done). But I think that this shape is workinig.

That's fine, just one small remark: next time, when you ask for review, add further features in separate PR (I refer to b51deee). It is more complicate to review a moving target, and if you believe to be ready to go, maybe the further bits do not belong to the same PR :)

MatteoRobbiati commented 1 year ago

That's fine, just one small remark: next time, when you ask for review, add further features in separate PR (I refer to b51deee). It is more complicate to review a moving target, and if you believe to be ready to go, maybe the further bits do not belong to the same PR :)

Yes, you're totally right. Thank you :)