feat: support rendering syntax diagrams#83
Conversation
|
ping @YiniXu9506 |
|
@kennytm Thanks for your contribution, I will take a look ASAP. |
|
@kennytm Sorry for so late to review this PR because I turned to develop the I will dig into the implementation of this remark plugin in the next few days. |
|
Thanks @g1eny0ung. Material UI has been replaced by Bulma in e0a2773. The style is slightly adjusted (the buttons are no longer ALL CAPS, which was forced by MUI).
If we're using Material UI only for the icons, why not use the Material Design Icons instead, which is the same but has zero dependencies 🤔
(* = introduced in this PR, so can be replaced by other icons I like 🙃) |
After searching, I found that if we want to use this package with React. We still need to import the Why we using the
|
|
@nullnotnil @lysu FYI. |

This PR introduced a remark plugin to supplement code blocks of the form:
with an SVG syntax diagram. A
<SyntaxDiagram>shortcode is introduced for the user to toggle between the diagram and EBNF.This is intended to gradually replace the entire media/sqlgram directory, to unify the appearances, simplify documentation process, and improve accessibility (images can't be searched).
Preview
The syntax diagram is generated using
@prantlf/railroad-diagrams, and the style has been tweaked to mimic the Railroad Diagram generator used to produce the original images. There are two differences though:Horizontal scrollbar
In theory
@prantlf/railroad-diagramshas theStackelement for manually breaking up the diagram into multiple rows. But in reality there is some bug in the height calculation which caused different rows to overlap. So in this PR we won't include such feature. (And scrolling is needed for mobile anyway.)