Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom ADR template? #120

Open
devinnasar opened this issue Aug 9, 2021 · 2 comments
Open

Custom ADR template? #120

devinnasar opened this issue Aug 9, 2021 · 2 comments

Comments

@devinnasar
Copy link

Hello,

One thing I'd like to do is synchronize ADRs in git repos with documentation published in Confluence. To that end, I'd like to use this project: https://github.com/kovetskiy/mark, which requires adding special notation to markdown files. I'd like to be able to use a custom ADR template on a per-repo basis. Does adr-tools support this currently/is there a way to accomplish this? Thanks!

@imankulov
Copy link

adr-tools support custom templates

The documentation may not be clear, but this example in tests shows how to use them.

You create a file templates/template.md inside a directory with your ADRs. In the template, you can use variables TITLE, STATUS, NUMBER, and DATE (just like this, words in uppercase.) That's it. The next call of adr new will use this template.

@gelisam
Copy link

gelisam commented Jun 3, 2022

Note that _adr_title currently assumes that the first line of the file has the form # TITLE. Thus, given the template

<!-- Space: <space key> -->
<!-- Title: TITLE -->

## Status

STATUS

## Next section

Running adr new "My Test" will correctly generate an ADR file with the title in the right spot:

EDITOR=cat adr new "My test"
<!-- Space: <space key> -->
<!-- Title: My test -->

## Status

Accepted

## Next section

But the other commands will use the wrong title to refer to the "My Test" ADR:

$ EDITOR=cat adr new "My Test"
<!-- Space: <space key> -->
<!-- Title: My Test -->

## Status

Accepted

## Next section

$ EDITOR=cat adr new -s my-test "My Second Test"
<!-- Space: <space key> -->
<!-- Title: My Second Test -->

## Status

Accepted

Supercedes [-- Space: <space key> -->](0002-my-test.md)

## Next section

$ cat docs/adr/0002-my-test.md
<!-- Space: <space key> -->
<!-- Title: My Test -->

## Status

Superceded by [-- Space: <space key> -->](0003-my-second-test.md)

## Next section

$ adr generate toc
# Architecture Decision Records

* [1. Record architecture decisions](0001-record-architecture-decisions.md)
* [-- Space: <space key> -->](0002-my-test.md)
* [-- Space: <space key> -->](0003-my-second-test.md)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants