-
Notifications
You must be signed in to change notification settings - Fork 688
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
Implement SQL formatter into the docs pipeline #13031
Comments
@qiancai Here are some suggestions, taking this document for example:
P.S. I think this formatter tool looks sweet, it comes with a yarn package and is easy to integrate. |
Plus, the user might not want to copy |
Hi @curiousRay Many thanks for the investigation. Yes, as we have a large number of instances that include both SQL statements and their results in one code block, it is hard for the formatter tool to distinguish them. As for "mysql>", we can directly remove it from the Markdown source file because the website renders the doc according to ```sql instead of "mysql>". |
/cc @dveeden |
@curiousRay @qiancai I've created a proof of concept SQL formatter for markdown based on TiDB: https://github.com/dveeden/tidb-markdown-sql-format If we can remove the prompt and add it back when rendering that would be good. I think we should aim to have something like this:
This has:
However we currently have many places with:
If we split the SQL statement and output code block we could even have a formatter that formats the tabular output in a nicely looking table if we want. However I'm not sure if we should do that at some point and I don't think we should do that now. |
@curiousRay it now also has TiDB support: |
Change Request
Describe what you find is inappropriate or missing in the existing docs.
It would be better to have SQL code be more readable by default and be stacked as opposed to all one line.
For example, the line:
Would be more readable as:
Describe your suggestion or addition.
Try and put something like https://sqlfum.pt/ into the docs pipeline to automatically:
Provide some reference materials (such as documents and websites) if you could.
https://github.com/mjibson/sqlfmt (which is https://wasm.sqlfum.pt/ )
https://sqlfmt.com/
https://www.salvis.com/blog/2020/08/28/formatting-sql-code-blocks-in-markdown-files/
The text was updated successfully, but these errors were encountered: