-
Notifications
You must be signed in to change notification settings - Fork 156
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
Fix broken links in lists and indented text #248
Conversation
The link still appears to be broken: should be: https://deploy-preview-248--tekton.netlify.app/docs/pipelines/pipelineruns#service-accounts Also the Edit: Ah I see there were 2 issues reported, this PR fixes the issue with the Interceptors link on the Triggers page 👍 The other issue remains. |
Indeed, the other issue is that the original text breaks the link on two lines:
Since that is supported by the HTML renderer, we should probably support it too... but to support that we'll have to change the behaviour of the script a bit, the line by line parsing won't be able to detect the link in there. |
I think it's reasonable to expect that links wouldn't be split across multiple lines like that in the markdown. While technically we could update the parser to detect this type of case I'm not sure it's worth the added complexity and we're likely to be missing other cases too. I'd be happy just to fix the markdown. What do you think? |
That's true, however I'm afraid there may be more errors hidden in the current line-by-line parsing approach. |
3f46cc1
to
a3bee90
Compare
When replacing links, we parse the markdown document line by line. When the markdown parsers encounters an indented line, without the context of the surrounding lines, it assumes a code block and does not render the links to html, which means we do not re-write those links. If the link is broken over two lines we also fail to discover it. This patch fixes the issue by changing the processing from line by line to the document as a whole. Fixes: tektoncd#229 Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
a3bee90
to
491f5c7
Compare
@tektoncd/website-maintainers All broken links reported in #229 are fixed by this, except for an invalid fragment which is fixed in tektoncd/pipeline#3773. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for adding the extra tests too 👍
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlanGreene The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Changes
When replacing links, we parse the markdown document line by line. When
the markdown parsers encounters an indented line, without the context of
the surrounding lines, it assumes a code block and does not render the
links to html, which means we do not re-write those links.
This patch fixes the issue by stripping left spaces in the text
fragments sent to "get_links", so that we can extract links successfully
and preserve the spaces in the rendered markdown.
Fixes: #229
Signed-off-by: Andrea Frittoli andrea.frittoli@gmail.com
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide
for more details.
/kind bug
/cc @AlanGreene