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

Support links between ADR's #284

Merged
merged 2 commits into from
Aug 30, 2023
Merged

Support links between ADR's #284

merged 2 commits into from
Aug 30, 2023

Conversation

dirkgroot
Copy link
Collaborator

@dirkgroot dirkgroot commented Aug 11, 2023

When importing ADR's, Structurizr automatically transforms links to other ADR's. This PR adds functionality to transform these transformed links into links that correctly link to the corresponding ADR.

Fixes #260.

Example

Assuming an existing ADR file named 0001-first-adr.md, an ADR like this:

# 2. Some ADR

[link to ADR 1](0001-first-adr.md)

will be transformed by Structurizr to:

# 2. Some ADR

[link to ADR 1](#1)

The new functionality from this PR will in turn transfer this to the following in case of a workspace-level ADR:

# 2. Some ADR

[link to ADR 1](decisions/1)

and to the following in case of an ADR for a software system named "Software System":

# 2. Some ADR

[link to ADR 1](software-system/decisions/1)

@dirkgroot dirkgroot requested a review from jp7677 August 11, 2023 09:54
@dirkgroot
Copy link
Collaborator Author

@jp7677 This is what I came up with to fix #260. Could you review this?

Copy link
Contributor

@jp7677 jp7677 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool to have this fixed.
Using regex for preprocessing looks simple and effective, that said, we already have a place for link transformation. We could explore to transform the ADR links there as well.
(https://github.com/avisi-cloud/structurizr-site-generatr/blob/main/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/MarkdownToHtml.kt#L35)

@dirkgroot
Copy link
Collaborator Author

Cool to have this fixed. Using regex for preprocessing looks simple and effective, that said, we already have a place for link transformation. We could explore to transform the ADR links there as well. (https://github.com/avisi-cloud/structurizr-site-generatr/blob/main/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/MarkdownToHtml.kt#L35)

I prefer having the transformation logic close to the code where it's needed, preferrably within the context where it's applicable. I'm going to leave it like this. Thanks!

@dirkgroot dirkgroot merged commit a9dbcc2 into main Aug 30, 2023
@jp7677 jp7677 deleted the fix-adr-links branch January 30, 2024 18:48
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

Successfully merging this pull request may close these issues.

links between ADR's are not working in generated site
2 participants