npm install prettier-plugin-dbml --save-devprettier --write *.dbml- Comments will be removed.
The DBML parser and exporter currently have a few limitations that require small workarounds in this plugin:
@dbml/coreresolves table aliases to their original table names when exporting references. The plugin post-processesReflines to restore the aliases without modifying the parsed AST, which could otherwise affect the table declarations themselves.ModelExporterdoes not include the top-levelProjectblock in its DBML output. The plugin rebuilds it from the project name, database type, and note stored in the AST.ModelExporteremits quoted identifiers and may omit the space afterRef:. The plugin removes quotes around identifiers while preserving quoted string values, and normalizesRef:spacing to keep the output consistent with regular DBML syntax.- Line comments are discarded by the DBML parser and are therefore not available in the AST. They cannot be restored by the plugin and are removed during formatting.