Skip to content

Commit

Permalink
feat(with-automd): separator option
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 20, 2024
1 parent f627d63 commit 7e5d3a6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/a

<!-- /automd -->

---

<!-- automd:with-automd -->
<!-- automd:with-automd separator -->

---
_🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: Tue Feb 20 2024)_

<!-- /automd -->
2 changes: 2 additions & 0 deletions docs/2.generators/with-automd.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The `with-automd` generator generates a benner that notifies docs are updated wi

<!-- automd:with-automd lastUpdate=now -->

---
_🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: now)_

<!-- /automd -->
Expand All @@ -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 `---`
12 changes: 11 additions & 1 deletion src/generators/with-automd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
};
},
});
1 change: 1 addition & 0 deletions test/fixture/OUTPUT.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import { foo, bar } from "https://esm.sh/pkg";

<!-- automd:with-automd -->

---
_🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: Tue Feb 20 2024)_

<!-- /automd -->
Expand Down
1 change: 1 addition & 0 deletions test/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe("transform", () => {
b
<!-- automd:with-automd lastUpdate=now -->
---
_🤖 docs are auto updated with [automd](https:/automd.unjs.io) (last updated: now)_
<!-- /automd -->
Expand Down

0 comments on commit 7e5d3a6

Please sign in to comment.