{"id":10477,"date":"2020-08-28T15:53:57","date_gmt":"2020-08-28T13:53:57","guid":{"rendered":"https:\/\/www.salvis.com\/blog\/?p=10477"},"modified":"2023-11-12T13:51:52","modified_gmt":"2023-11-12T12:51:52","slug":"formatting-sql-code-blocks-in-markdown-files","status":"publish","type":"post","link":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/","title":{"rendered":"Formatting SQL Code Blocks in Markdown Files"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Everything Changes. Our <a href=\"https:\/\/github.com\/trivadis\/plsql-and-sql-coding-guidelines\">Trivadis SQL &amp; PL\/SQL Coding Guidelines<\/a> are no exceptions. We plan to change rule #1 of our <a href=\"https:\/\/trivadis.github.io\/plsql-and-sql-coding-guidelines\/v3.6\/3-coding-style\/coding-style\/#rules\">coding styles<\/a>. From &#8220;<em>Keywords are written uppercase, names are written in lowercase.&#8221;<\/em>&nbsp; to &#8220;<em>Keywords and names are written in lowercase.<\/em>&#8220;. We have 103 Markdown files and most of them contain several SQL code blocks complying to our current (old) rule #1. Should we change these files manually? Nah, this is boring and error-prone. It&#8217;s a perfect case to automate it and to show how you can format SQL code blocks in Markdown with SQLcl.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tools<\/h2>\n\n\n\n<p>For this task, we use <a href=\"https:\/\/www.oracle.com\/tools\/downloads\/sqlcl-downloads.html\">SQLcl 20.2.0<\/a>. If you work with Oracle databases, you have most likely already installed it.<\/p>\n\n\n\n<p>SQLcl is basically <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/sqpug\/index.html\">SQL*Plus<\/a> on steroids. One of the most underestimated features of SQLcl is the ability to execute JavaScript and provide them as custom SQLcl commands (read <a href=\"https:\/\/twitter.com\/evrocs_nl\">Erik van Roon<\/a>&#8216;s excellent <a href=\"https:\/\/www.evrocs.nl\/being-in-command\/?lang=en\">blog post<\/a> to learn more about it). We use the custom command <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/tree\/main\/sqlcl#register-script-formatjs-as-sqlcl-command-tvdformat\">tvdformat<\/a>. To install it, save <a href=\"https:\/\/raw.githubusercontent.com\/Trivadis\/plsql-formatter-settings\/main\/sqlcl\/format.js\">format.js<\/a> locally in a folder of your choice. Then start SQLcl (no connection required), go to the folder where you&#8217;ve saved <code>format.js<\/code> and run <code>script format.js -r<\/code>. This will register the command <code>tvdformat<\/code>. You get the usage help, when you enter the command without arguments.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"775\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat.png\" alt=\"\" class=\"wp-image-10480\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat.png 1020w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat-300x228.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat-768x584.png 768w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat-192x146.png 192w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat-50x38.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat-99x75.png 99w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat-1x1.png 1w\" sizes=\"auto, (max-width:767px) 480px, (max-width:1020px) 100vw, 1020px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Formatting a Single Markdown File<\/h2>\n\n\n\n<p>Let&#8217;s create a simple Markdown file to see how the formatter behaves.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">example.md (unformatted)<\/span><span role=\"button\" tabindex=\"0\" data-code=\"## SQL to be formated\n\n``` sql\nSELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;\n```\n\n## SQL to be ignored\n\n```\nSELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;\n```\n\n## JavaScript to be ignored\n\n``` js\nvar foo = function (bar) {\n  return bar++;\n};\n```\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## SQL to be formated<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">``` sql<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> * <\/span><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> EMP <\/span><span style=\"color: #569CD6\">JOIN<\/span><span style=\"color: #D4D4D4\"> DEPT <\/span><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> EMP.DEPTNO = DEPT.DEPTNO;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## SQL to be ignored<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">SELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## JavaScript to be ignored<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">``` js<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">var<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">foo<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #9CDCFE\">bar<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">bar<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Save the content in a file named <code>example.md<\/code>. And then run <code>tvdformat example.md<\/code>. This will format this file with default settings. Default means with the embedded advanced settings (xml) and the default custom settings (arbori).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"229\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md.png\" alt=\"\" class=\"wp-image-10483\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md.png 1020w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md-300x67.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md-768x172.png 768w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md-260x58.png 260w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md-50x11.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md-150x34.png 150w\" sizes=\"auto, (max-width:767px) 480px, (max-width:1020px) 100vw, 1020px\" \/><\/a><\/figure>\n\n\n\n<p>The result should look like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);--cbp-line-highlight-color:rgba(234, 191, 191, 0.2);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">example.md (formatted)<\/span><span role=\"button\" tabindex=\"0\" data-code=\"## SQL to be formated\n \n``` sql\nSELECT *\n  FROM EMP\n  JOIN DEPT\nON EMP.DEPTNO = DEPT.DEPTNO;\n```\n \n## SQL to be ignored\n \n```\nSELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;\n```\n \n## JavaScript to be ignored\n \n``` js\nvar foo = function (bar) {\n  return bar++;\n};\n```\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## SQL to be formated<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">``` sql<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #569CD6\">SELECT<\/span><span style=\"color: #D4D4D4\"> *<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">FROM<\/span><span style=\"color: #D4D4D4\"> EMP<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #569CD6\">JOIN<\/span><span style=\"color: #D4D4D4\"> DEPT<\/span><\/span>\n<span class=\"line cbp-line-highlight\"><span style=\"color: #569CD6\">ON<\/span><span style=\"color: #D4D4D4\"> EMP.DEPTNO = DEPT.DEPTNO;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## SQL to be ignored<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">SELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## JavaScript to be ignored<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">``` js<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">var<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">foo<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #9CDCFE\">bar<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">bar<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>As you see only the first SQL statement is formatted. The other code blocks are left as is. Only code blocks with <code>sql<\/code> syntax highlighting are formatted.<\/p>\n\n\n\n<p>The indentation of line 7 is wrong. It&#8217;s an issue of the default Arbori program. It&#8217;s addressed in <code>trivadis_custom_format.arbori<\/code>. However,&nbsp; we do not want to format the code blocks anyway. We just want to change the keywords and identifiers to lowercase.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Changing Keywords and Identifiers to Lowercase<\/h2>\n\n\n\n<p>You can export the advanced format settings in SQL Developer. When you look at the options in the resulting XML file, the first option is <code>adjustCaseOnly<\/code>. This option cannot be set in the Advanced Format preferences. It&#8217;s set to <code>false<\/code> by default. When changed to <code>true<\/code> the formatter still executes some part of the Arbori program, but basically skips all actions that deal with whitespace before a node. Knowing that we can create the following <code>options.xml<\/code> file:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">options.xml<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;options&gt;\n    &lt;adjustCaseOnly&gt;true&lt;\/adjustCaseOnly&gt;\n    &lt;idCase&gt;oracle.dbtools.app.Format.Case.lower&lt;\/idCase&gt;\n    &lt;kwCase&gt;oracle.dbtools.app.Format.Case.lower&lt;\/kwCase&gt;\n&lt;\/options&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #808080\">&lt;<\/span><span style=\"color: #569CD6\">options<\/span><span style=\"color: #808080\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #808080\">&lt;<\/span><span style=\"color: #569CD6\">adjustCaseOnly<\/span><span style=\"color: #808080\">&gt;<\/span><span style=\"color: #D4D4D4\">true<\/span><span style=\"color: #808080\">&lt;\/<\/span><span style=\"color: #569CD6\">adjustCaseOnly<\/span><span style=\"color: #808080\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #808080\">&lt;<\/span><span style=\"color: #569CD6\">idCase<\/span><span style=\"color: #808080\">&gt;<\/span><span style=\"color: #D4D4D4\">oracle.dbtools.app.Format.Case.lower<\/span><span style=\"color: #808080\">&lt;\/<\/span><span style=\"color: #569CD6\">idCase<\/span><span style=\"color: #808080\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #808080\">&lt;<\/span><span style=\"color: #569CD6\">kwCase<\/span><span style=\"color: #808080\">&gt;<\/span><span style=\"color: #D4D4D4\">oracle.dbtools.app.Format.Case.lower<\/span><span style=\"color: #808080\">&lt;\/<\/span><span style=\"color: #569CD6\">kwCase<\/span><span style=\"color: #808080\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #808080\">&lt;\/<\/span><span style=\"color: #569CD6\">options<\/span><span style=\"color: #808080\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Let&#8217;s reset the content of <code>example.md<\/code> to the unformatted one. And then run <code>tvdformat example.md xml=options.xml<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"179\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options.png\" alt=\"\" class=\"wp-image-10488\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options.png 1020w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options-300x53.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options-768x135.png 768w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options-260x46.png 260w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options-50x9.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_example_md_with_options-150x26.png 150w\" sizes=\"auto, (max-width:767px) 480px, (max-width:1020px) 100vw, 1020px\" \/><\/a><\/figure>\n\n\n\n<p>Now, the result should look like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2b2b2b;color:#c7c7c7\">example.md (formatted with options.xml)<\/span><span role=\"button\" tabindex=\"0\" data-code=\"## SQL to be formated\n\n``` sql\nselect * from emp join dept on emp.deptno = dept.deptno;\n```\n\n## SQL to be ignored\n\n```\nSELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;\n```\n\n## JavaScript to be ignored\n\n``` js\nvar foo = function (bar) {\n  return bar++;\n};\n```\n\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## SQL to be formated<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">``` sql<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">select<\/span><span style=\"color: #D4D4D4\"> * <\/span><span style=\"color: #569CD6\">from<\/span><span style=\"color: #D4D4D4\"> emp <\/span><span style=\"color: #569CD6\">join<\/span><span style=\"color: #D4D4D4\"> dept <\/span><span style=\"color: #569CD6\">on<\/span><span style=\"color: #D4D4D4\"> emp.deptno = dept.deptno;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## SQL to be ignored<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">SELECT * FROM EMP JOIN DEPT ON EMP.DEPTNO = DEPT.DEPTNO;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6; font-weight: bold\">## JavaScript to be ignored<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">``` js<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">var<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">foo<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #9CDCFE\">bar<\/span><span style=\"color: #D4D4D4\">) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">bar<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">};<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">```<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>As before, only the first code block changed. In this case, everything is in lowercase. However, the processing is more complicated behind the scenes. For example: comments, strings, and quoted identifiers are left untouched. So, it&#8217;s more than just a simple .toLowerCase() call and for sure worth using Oracle&#8217;s formatter for this task.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Is it Safe to Change the Case in PL\/SQL &amp; SQL?<\/h2>\n\n\n\n<p>PL\/SQL &amp; SQL are case-insensitive languages. So you might be tempted to answer this question with &#8220;Yes&#8221;. But it is not that easy. For keywords, it&#8217;s 100% true. However, this is not true for identifiers. <a href=\"https:\/\/twitter.com\/RogerTroller\">Roger Troller<\/a> was the first who showed me examples of unquoted, case-sensitive identifiers in SQL. One is documented <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/issues\/1\">here<\/a>.\u00a0 For example, if you use JSON columns the items in the JSON document are case-sensitive. Changing the case will break the code. That&#8217;s bad. This is also the reason, why we do not change the case of identifiers in our <a href=\"https:\/\/github.com\/Trivadis\/plsql-formatter-settings\/blob\/main\/settings\/sql_developer\/trivadis_advanced_format.xml#L19\">formatter configuration<\/a>.<\/p>\n\n\n\n<p>Therefore, be careful, if you change the case of identifiers. This might break your code. Depending on your test coverage you might detect this problem very late, because the program might still compile, but not produce the expected results anymore (as in the mentioned example).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bulk Processing<\/h2>\n\n\n\n<p>In our case, we know that we do not have JSON-based code snippets in our Markdown files. Therefore it is safe to change the case of identifiers in all files.<\/p>\n\n\n\n<p>To process all files in the <code>docs<\/code> directory including all subdirectories I run <code>tvdformat docs&nbsp;xml=options.xml arbori=default<\/code>. I pass the arbori option only to avoid the warning message.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1036\" height=\"793\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2.png\" alt=\"\" class=\"wp-image-10507\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2.png 1036w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-300x230.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-1024x784.png 1024w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-768x588.png 768w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-191x146.png 191w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-50x38.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-98x75.png 98w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/tvdformat_bulk2-1x1.png 1w\" sizes=\"auto, (max-width:767px) 480px, (max-width:1036px) 100vw, 1036px\" \/><\/a><\/figure>\n\n\n\n<p>In this case, the code is based on a Git repository. Therefore I can browse through the changes before committing them. Here&#8217;s an excerpt of the <code>g-1050.md<\/code> file.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1372\" height=\"644\" src=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case.png\" alt=\"\" class=\"wp-image-10494\" srcset=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case.png 1372w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case-300x141.png 300w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case-1024x481.png 1024w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case-768x360.png 768w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case-260x122.png 260w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case-50x23.png 50w, https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/g-1050-changed-case-150x70.png 150w\" sizes=\"auto, (max-width:767px) 480px, (max-width:1372px) 100vw, 1372px\" \/><\/a><\/figure>\n\n\n\n<p>You see that the original whitespace is preserved. Only keywords and identifiers are changed to lowercase. The string &#8216;AD_PERS&#8217; is still in uppercase. This looks good. Ready to be checked in.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Recommendations<\/h2>\n\n\n\n<p>The current formatter settings are probably not good enough for all code. There are for sure some cases where the original code base is formatted so badly, that an imperfect formatting configuration leads to a huge improvement. But generally, this is not good enough. You can use the formatter when writing code. That includes changing existing code when the current formatting style makes it difficult to read. You can always select a portion of code (a subquery, a function, etc.), format it and then change the things you don&#8217;t like. It&#8217;s easy to undo the changes in the IDE. This is also possible if you apply the formatter for a large number of files, especially if you use a version control system such as Git. It is simple to undo everything. However, when you change hundreds of files you will easily overlook some uglified code.<\/p>\n\n\n\n<p>For bulk processing, changing the case of keywords is safe. Changing the case of identifiers is possible. But be careful, if you are using case-sensitive SQL, this will break your code.<\/p>\n\n\n\n<p>Whatever you do, make sure you keep the version before applying the formatter. And do not forget to test and review the result.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Everything Changes. Our Trivadis SQL &amp; PL\/SQL Coding Guidelines are no exceptions. We plan to change rule #1 of our coding styles. From &#8220;Keywords are written uppercase, names are written in lowercase.&#8221;&nbsp; to &#8220;Keywords and names are written in lowercase.&#8220;. We have 103 Markdown files and most of them contain several<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":10506,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[129,135,13,85,87,126],"class_list":["post-10477","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-arbori","tag-javascript","tag-plsql","tag-sql","tag-sql-developer","tag-sqlcl"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Formatting SQL Code Blocks in Markdown Files - Philipp Salvisberg&#039;s Blog<\/title>\n<meta name=\"description\" content=\"Format SQL code blocks in more than hundred Markdown files. Configure the formatter to change the case of keywords and identifiers only.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Formatting SQL Code Blocks in Markdown Files - Philipp Salvisberg&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Format SQL code blocks in more than hundred Markdown files. Configure the formatter to change the case of keywords and identifiers only.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/\" \/>\n<meta property=\"og:site_name\" content=\"Philipp Salvisberg&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-28T13:53:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-12T12:51:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/uppercase-lowercase-meme4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"473\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Philipp Salvisberg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@phsalvisberg\" \/>\n<meta name=\"twitter:site\" content=\"@phsalvisberg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Philipp Salvisberg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/\"},\"author\":{\"name\":\"Philipp Salvisberg\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"headline\":\"Formatting SQL Code Blocks in Markdown Files\",\"datePublished\":\"2020-08-28T13:53:57+00:00\",\"dateModified\":\"2023-11-12T12:51:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/\"},\"wordCount\":980,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"image\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/uppercase-lowercase-meme4.png\",\"keywords\":[\"Arbori\",\"JavaScript\",\"PL\\\/SQL\",\"SQL\",\"SQL Developer\",\"SQLcl\"],\"articleSection\":[\"Oracle\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/\",\"name\":\"Formatting SQL Code Blocks in Markdown Files - Philipp Salvisberg&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/uppercase-lowercase-meme4.png\",\"datePublished\":\"2020-08-28T13:53:57+00:00\",\"dateModified\":\"2023-11-12T12:51:52+00:00\",\"description\":\"Format SQL code blocks in more than hundred Markdown files. Configure the formatter to change the case of keywords and identifiers only.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/uppercase-lowercase-meme4.png\",\"contentUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/uppercase-lowercase-meme4.png\",\"width\":473,\"height\":450},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/2020\\\/08\\\/28\\\/formatting-sql-code-blocks-in-markdown-files\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Formatting SQL Code Blocks in Markdown Files\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/\",\"name\":\"Philipp Salvisberg&#039;s Blog\",\"description\":\"Database-centric development\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/#\\\/schema\\\/person\\\/34352245c48678b1a5a05d4bc1339515\",\"name\":\"Philipp Salvisberg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"url\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"contentUrl\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\",\"width\":400,\"height\":400,\"caption\":\"Philipp Salvisberg\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.salvis.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/11\\\/phs_trivadis4.jpg\"},\"sameAs\":[\"http:\\\/\\\/www.salvis.com\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Formatting SQL Code Blocks in Markdown Files - Philipp Salvisberg&#039;s Blog","description":"Format SQL code blocks in more than hundred Markdown files. Configure the formatter to change the case of keywords and identifiers only.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/","og_locale":"en_US","og_type":"article","og_title":"Formatting SQL Code Blocks in Markdown Files - Philipp Salvisberg&#039;s Blog","og_description":"Format SQL code blocks in more than hundred Markdown files. Configure the formatter to change the case of keywords and identifiers only.","og_url":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/","og_site_name":"Philipp Salvisberg&#039;s Blog","article_published_time":"2020-08-28T13:53:57+00:00","article_modified_time":"2023-11-12T12:51:52+00:00","og_image":[{"width":473,"height":450,"url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/uppercase-lowercase-meme4.png","type":"image\/png"}],"author":"Philipp Salvisberg","twitter_card":"summary_large_image","twitter_creator":"@phsalvisberg","twitter_site":"@phsalvisberg","twitter_misc":{"Written by":"Philipp Salvisberg","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#article","isPartOf":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/"},"author":{"name":"Philipp Salvisberg","@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"headline":"Formatting SQL Code Blocks in Markdown Files","datePublished":"2020-08-28T13:53:57+00:00","dateModified":"2023-11-12T12:51:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/"},"wordCount":980,"commentCount":0,"publisher":{"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"image":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/uppercase-lowercase-meme4.png","keywords":["Arbori","JavaScript","PL\/SQL","SQL","SQL Developer","SQLcl"],"articleSection":["Oracle"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/","url":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/","name":"Formatting SQL Code Blocks in Markdown Files - Philipp Salvisberg&#039;s Blog","isPartOf":{"@id":"https:\/\/www.salvis.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#primaryimage"},"image":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#primaryimage"},"thumbnailUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/uppercase-lowercase-meme4.png","datePublished":"2020-08-28T13:53:57+00:00","dateModified":"2023-11-12T12:51:52+00:00","description":"Format SQL code blocks in more than hundred Markdown files. Configure the formatter to change the case of keywords and identifiers only.","breadcrumb":{"@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#primaryimage","url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/uppercase-lowercase-meme4.png","contentUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2020\/08\/uppercase-lowercase-meme4.png","width":473,"height":450},{"@type":"BreadcrumbList","@id":"https:\/\/www.salvis.com\/blog\/2020\/08\/28\/formatting-sql-code-blocks-in-markdown-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.salvis.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Formatting SQL Code Blocks in Markdown Files"}]},{"@type":"WebSite","@id":"https:\/\/www.salvis.com\/blog\/#website","url":"https:\/\/www.salvis.com\/blog\/","name":"Philipp Salvisberg&#039;s Blog","description":"Database-centric development","publisher":{"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.salvis.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.salvis.com\/blog\/#\/schema\/person\/34352245c48678b1a5a05d4bc1339515","name":"Philipp Salvisberg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","url":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","contentUrl":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg","width":400,"height":400,"caption":"Philipp Salvisberg"},"logo":{"@id":"https:\/\/www.salvis.com\/blog\/wp-content\/uploads\/2010\/11\/phs_trivadis4.jpg"},"sameAs":["http:\/\/www.salvis.com\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/10477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/comments?post=10477"}],"version-history":[{"count":26,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/10477\/revisions"}],"predecessor-version":[{"id":12687,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/posts\/10477\/revisions\/12687"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/media\/10506"}],"wp:attachment":[{"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/media?parent=10477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/categories?post=10477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.salvis.com\/blog\/wp-json\/wp\/v2\/tags?post=10477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}