Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(format): generate correct index links for Azure DevOps #10

Merged
merged 1 commit into from
Jan 5, 2020

Conversation

princjef
Copy link
Owner

@princjef princjef commented Jan 5, 2020

Unlike GitHub, Azure DevOps does not strip unprinted text from headers when generating the link to them. As a result, the addition of code links to the headers broke the Azure DevOps index links.

This change makes link generation more robust and changes the index link inputs to match the actual header values. This necessitated some changes:

  • The GitHub format's LocalHref() now strips any non-printable text before generating the link contents. This allows more complicated header contents (such as those with links inside of them) to produce the correct output, rather than having to know the plain text form of the header in advance.
  • The Azure DevOps link format is considerably harder to get right. The previous backslash escaping approach doesn't work when the link text itself contains a link (the DevOps link generator bails completely). A more robust solution turned out to be URL-escaping the entire link contents, which DevOps is able to handle regardless of contents.

@princjef
Copy link
Owner Author

princjef commented Jan 5, 2020

The linter wasn't picking up on the fact that the templates.go file is autogenerated, so updated the script to move the comment to the top of the file.

@princjef princjef merged commit 33a0f5c into master Jan 5, 2020
@princjef princjef deleted the fix-links branch January 5, 2020 20:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant