Skip to content

Commit

Permalink
fix(with-automd): hide last update by default
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 21, 2024
1 parent 4017016 commit 96e2ade
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 6 additions & 5 deletions docs/2.generators/with-automd.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

The `with-automd` generator generates a benner that notifies docs are updated with automd + the last update time.

<!-- automd:example generator=with-automd lastUpdate="now" -->
<!-- automd:example generator=with-automd -->

## Example

### Input

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

### Output

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

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

_🤖 auto updated with [automd](https://automd.unjs.io)_

<!-- /automd -->

<!-- /automd -->

## Arguments

- `lastUpdate`: Can override last updated time. Use `no-lastUpdate` to disable.
- `lastUpdate`: Show last updated date. (use string for static value)
- `no-separator`: Disable addition of separator `---`
7 changes: 3 additions & 4 deletions src/generators/with-automd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { defineGenerator } from "../generator";
export const withAutomd = defineGenerator({
name: "with-automd",
generate({ args }) {
const lastUpdate =
args.lastUpdate === false
? ""
: ` (last updated: ${args.lastUpdate || new Date().toDateString()})`;
const lastUpdate = args.lastUpdate
? ` (last updated: ${typeof args.lastUpdate === "string" ? args.lastUpdate : new Date().toDateString()})`
: "";

const emoji = args.emoji === false ? "" : "🤖 ";

Expand Down
2 changes: 1 addition & 1 deletion test/fixture/OUTPUT.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ import { foo, bar } from "https://esm.sh/pkg";

---

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

<!-- /automd -->

Expand Down

0 comments on commit 96e2ade

Please sign in to comment.