adr-tools icon indicating copy to clipboard operation
adr-tools copied to clipboard

Custom ADR template?

Open devinnasar opened this issue 4 years ago • 2 comments

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!

devinnasar avatar Aug 09 '21 19:08 devinnasar

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.

imankulov avatar Feb 11 '22 10:02 imankulov

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)

gelisam avatar Jun 03 '22 18:06 gelisam