From 1c58f90aacbdb39330910cef004fb2ab564cc8b7 Mon Sep 17 00:00:00 2001 From: Mirat Can Bayrak Date: Tue, 21 Jul 2026 13:42:40 +0300 Subject: [PATCH] Fix multiline note rendering in DBML output - Fix table-level Note: multiline closing ''' now on its own line instead of at end of last content line, fixing dbdiagram.io parse errors for table notes. - Same fix for field-level multiline notes (note: '''...'''). The parser expects the closing triple single-quote to be on a separate line for proper multiline string termination. --- django_dbml/core/renderer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_dbml/core/renderer.py b/django_dbml/core/renderer.py index ccbb8cc..96b92b6 100644 --- a/django_dbml/core/renderer.py +++ b/django_dbml/core/renderer.py @@ -56,7 +56,7 @@ def render_table(self, table_name: str, table: TableDefinition) -> list[str]: blocks.append(f"Table {table_name} {{") if table.note: - blocks.append(" Note: '''\n{}'''\n".format(cleanup_docstring(table.note))) + blocks.append(" Note: '''\n{}\n'''\n".format(cleanup_docstring(table.note))) for field_name, field in table.fields.items(): blocks.append(f" {field_name} {field.type} {self.render_field_attributes(field)}".rstrip()) @@ -79,7 +79,7 @@ def render_field_attributes(self, field: FieldDefinition) -> str: # noqa: PLR09 if field.note: note = field.note.replace("'", '"') if "\n" in note: - attributes.append(f"note: '''\n{note}'''") + attributes.append(f"note: '''\n{note}\n'''") else: attributes.append(f"note: '''{note}'''")