From 7e5d3a6c5e0b5e4107c75ca5b293f6de5b4eada9 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 20 Feb 2024 19:31:19 +0100 Subject: [PATCH] feat(with-automd): `separator` option --- README.md | 5 ++--- docs/2.generators/with-automd.md | 2 ++ src/generators/with-automd.ts | 12 +++++++++++- test/fixture/OUTPUT.md | 1 + test/transform.test.ts | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6851522..18c4d97 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,9 @@ Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/a ---- - - + +--- _🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: Tue Feb 20 2024)_ diff --git a/docs/2.generators/with-automd.md b/docs/2.generators/with-automd.md index 578d9bb..f6d7d17 100644 --- a/docs/2.generators/with-automd.md +++ b/docs/2.generators/with-automd.md @@ -15,6 +15,7 @@ The `with-automd` generator generates a benner that notifies docs are updated wi + --- _🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: now)_ @@ -24,3 +25,4 @@ The `with-automd` generator generates a benner that notifies docs are updated wi ## Arguments - `lastUpdate`: Can override last updated time. Use `no-lastUpdate` to disable. +- `no-separator`: Disable addition of separator `---` diff --git a/src/generators/with-automd.ts b/src/generators/with-automd.ts index 50375e2..bdca80e 100644 --- a/src/generators/with-automd.ts +++ b/src/generators/with-automd.ts @@ -10,8 +10,18 @@ export const withAutomd = defineGenerator({ const emoji = args.emoji === false ? "" : "🤖 "; + const lines: string[] = []; + + if (args.separator !== false) { + lines.push("---"); + } + + lines.push( + `_${emoji}docs are auto updated with [automd](https:/automd.unjs.io)${lastUpdate}_`, + ); + return { - contents: `_${emoji}docs are auto updated with [automd](https:/automd.unjs.io)${lastUpdate}_`, + contents: lines.join("\n"), }; }, }); diff --git a/test/fixture/OUTPUT.md b/test/fixture/OUTPUT.md index d82b2bd..383f339 100644 --- a/test/fixture/OUTPUT.md +++ b/test/fixture/OUTPUT.md @@ -103,6 +103,7 @@ import { foo, bar } from "https://esm.sh/pkg"; +--- _🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: Tue Feb 20 2024)_ diff --git a/test/transform.test.ts b/test/transform.test.ts index c6c7107..dc91709 100644 --- a/test/transform.test.ts +++ b/test/transform.test.ts @@ -90,6 +90,7 @@ describe("transform", () => { b + --- _🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: now)_