Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ERD.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Shopping Mall

> Generated by [`prisma-markdown`](https://github.com/samchon/prisma-markdown)

- [Articles](#articles)
- [Systematic](#systematic)
- [Actors](#actors)
Expand Down Expand Up @@ -2965,3 +2962,9 @@ Properties as follows:
- `primary`: Whether the favorite address is primary or not.
- `created_at`: Creation time of record.
- `deleted_at`: Deletion time of record.


---


> **Generated by [prisma-markdown](https://github.com/samchon/prisma-markdown)**
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 20 additions & 7 deletions src/PrismaMarkdown.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DMMF } from "@prisma/generator-helper";
import { IPrismaMarkdownChapter } from "./IPrismaMarkdownChapter";
import { PrismaUtil } from "./utils/PrismaUtil";
import { MapUtil } from "./utils/MapUtil";
import { IPrismaMarkdownConfig } from "./IPrismaMarkdownConfig";
import { PrismaMarkdownMermaidWriter } from "./writers/PrismaMarkdownMermaidWriter";
import { MapUtil } from "./utils/MapUtil";
import { PrismaUtil } from "./utils/PrismaUtil";
import { PrismaMarkdownDescriptionWriter } from "./writers/PrismaMarkdownDescriptionWriter";
import { PrismaMarkdownMermaidWriter } from "./writers/PrismaMarkdownMermaidWriter";

export namespace PrismaMarkdown {
export const write = (
Expand All @@ -15,17 +15,20 @@ export namespace PrismaMarkdown {
const title: string = config?.title ?? "Prisma Markdown";
const preface: string = [
`# ${title}`,
"",
"> Generated by [`prisma-markdown`](https://github.com/samchon/prisma-markdown)",
"",
...chapters.map(({ name }) => `- [${name}](#${name.toLowerCase()})`),
].join("\n");
if (chapters.length === 0) return preface;
if (chapters.length === 0)
return [
preface,
"",
...addGeneratedBy(),
].join("\n");
return [
preface, // table of contents
"", // gap between table of contents and first chapter
chapters.map(writeChapter).join("\n\n"), // gap between chapters
"",
...addGeneratedBy(),
].join("\n");
};

Expand Down Expand Up @@ -300,6 +303,16 @@ export namespace PrismaMarkdown {
});
return newbie;
};

const addGeneratedBy = () => {
return [
"",
"---",
Comment thread
maquejp marked this conversation as resolved.
"",
"",
"> **Generated by [prisma-markdown](https://github.com/samchon/prisma-markdown)**",
];
};
}

interface IChapter {
Expand Down
9 changes: 6 additions & 3 deletions test/drive/drive.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Virtual Drive System

> Generated by [`prisma-markdown`](https://github.com/samchon/prisma-markdown)

- [Actors](#actors)
- [Repositories](#repositories)

Expand Down Expand Up @@ -660,3 +657,9 @@ Properties as follows:
- `value`: Search tag value.
- `sequence`: Creation time of record.
- `created_at`:


---


> **Generated by [prisma-markdown](https://github.com/samchon/prisma-markdown)**
9 changes: 6 additions & 3 deletions test/implicit/implicit.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Implicit M: N relationships

> Generated by [`prisma-markdown`](https://github.com/samchon/prisma-markdown)

- [Articles](#articles)

## Articles
Expand Down Expand Up @@ -212,3 +209,9 @@ Properties as follows:

- `A`:
- `B`:


---


> **Generated by [prisma-markdown](https://github.com/samchon/prisma-markdown)**
9 changes: 6 additions & 3 deletions test/summary/summary.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Summary Tag

> Generated by [`prisma-markdown`](https://github.com/samchon/prisma-markdown)

- [Articles](#articles)

## Articles
Expand Down Expand Up @@ -234,3 +231,9 @@ Properties as follows:
> Sequence order.
>
> Sequence order of the attached file in the belonged snapshot.


---


> **Generated by [prisma-markdown](https://github.com/samchon/prisma-markdown)**