Skip to content

Commit

Permalink
Merge pull request #656 from jenspav/adr-links
Browse files Browse the repository at this point in the history
Suffix ADR links with slash
  • Loading branch information
jenspav authored Dec 19, 2024
2 parents 50489fe + e5867dd commit 1ef1ba0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
19 changes: 19 additions & 0 deletions docs/example/workspace-adrs/0002-implement-feature-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 2. Implement Feature 1

Date: 2024-12-17

## Status

Superseded by [3. Another Realisation of Feature 1](0003-another-realisation-of-feature-1.md)

## Context

The issue motivating this decision, and any context that influences or constrains the decision.

## Decision

The change that we're proposing or have agreed to implement.

## Consequences

What becomes easier or more difficult to do and any risks introduced by the change that will need to be mitigated.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 3. Another Realisation of Feature 1

Date: 2024-12-17

## Status

Accepted

Supersedes [2. Implement Feature 1](0002-implement-feature-1.md)

## Context

The issue motivating this decision, and any context that influences or constrains the decision.

## Decision

The change that we're proposing or have agreed to implement.

## Consequences

What becomes easier or more difficult to do and any risks introduced by the change that will need to be mitigated.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WorkspaceDecisionPageViewModel(generatorContext: GeneratorContext, decisio

private fun transformADRLinks(content: String) =
content.replace("\\[(.*)]\\(#(\\d+)\\)".toRegex()) {
"[${it.groupValues[1]}](decisions/${it.groupValues[2]})"
"[${it.groupValues[1]}](decisions/${it.groupValues[2]}/)"
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ class WorkspaceDecisionPageViewModelTest : ViewModelTest() {
content = """
Decision with [link to other ADR](#2).
[Web link](https://google.com)
[Internal link](#other-section)
[Section link](#other-section)
[Internal link](../embedding-diagrams-and-images/)
""".trimIndent()
}
val viewModel = WorkspaceDecisionPageViewModel(generatorContext(), decision)

assertThat(viewModel.content).isEqualTo(
toHtml(
viewModel, """
Decision with [link to other ADR](decisions/2).
Decision with [link to other ADR](decisions/2/).
[Web link](https://google.com)
[Internal link](#other-section)
[Section link](#other-section)
[Internal link](../embedding-diagrams-and-images/)
""".trimIndent(),
Format.Markdown,
svgFactory
Expand Down

0 comments on commit 1ef1ba0

Please sign in to comment.