jenkinsci / jenkinsci/markdown-formatter-plugin
[JENKINS-72916] A link in a build description gets truncated in the Job view with ellipses.
- Dominant language
- Java
- Stars
- 8
- Forks
- 4
- Avg merge
- 1h 48m
- Merged PRs (30d)
- 1
Description
When using the markdown plugin, a markdown link is properly rendered in the build view. However, while viewing the same build in the Job view, the markdown link gets truncated with ellipses.
This is not an issue while using Safe HTML.
Controller using Safe HTML
- Select a build (e.g. #5)
- Edit Build Information link (left)
Description:Commit: ["https://MY_BB_HOST/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits/0123456789abcdef0123456789abcdef01234567">abc123d]
- Save button
- OBSERVE: build #5 shows clickable link:
Commit: [abc123d] // this IS a clickable link
- Navigate back to job
- OBSERVE: list of jobs, build #5 shows clickable link:
Commit: [abc123d] // this IS a clickable link
Controller using markdown
- Select a build (e.g. #5)
- Edit Build Information link (left) or Add Description button
- Description:
__Commit__: [abc123d}(https://MY_BB_HOST/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits/0123456789abcdef0123456789abcdef01234567)]
- Save button
- OBSERVE: build # 5 shows clickable link:
Commit: [abc123d] // this IS a clickable link
- Navigate back to job
- OBSERVE: list of jobs, build #5 shows:
Commit:... //NOT a clickable or readable link
- Hypothesis: It appears that the plugin truncates the Commit string based on actual length rather than rendered length.
- Workaround: Just use the commit prefix string WITHOUT the link. (But... I like the link.)
- Other markdown (e.g. bold) for short strings appears to work as expected in both build and job views.
FWIW, I find adding a Commit link to the build from the pipeline EXTREMELY useful if I am quickly iterating. I find myself being impatient and smashing build button shortly after pushing a change. This quick look allows me to see the commit version without having to click into the job. Only caveat is my sample only shows last commit version, but good enough for my use.
Pipeline snippet: somewhere in an early stage... before things start to break ![]()
script{
...
env.REPO_URL_COMMITS = "https://MY_BB.com/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits" // only shown here for example, I will usually set in environment{} block
env.COMMIT_URL_MD = "[Commit ${GIT_COMMIT[0..6]}](${REPO_URL_COMMITS}/${GIT_COMMIT})" // truncates commit version to 7 characters for display text
currentBuild.description = "${COMMIT_URL_MD}" // add commit URL to build description
//OPTIONAL: add useful debug/iterate comments to description (note the double trailing spaces for linefeeds)
//currentBuild.description = "${COMMIT_URL_MD} \n${MY_CUSTOM_MESSAGE} \n \n---"
...
}
---
Originally reported by mb_austex, imported from: A link in a build description gets truncated in the Job view with ellipses.
Raw content of original issue
When using the markdown plugin, a markdown link is properly rendered in the build view. However, while viewing the same build in the Job view, the markdown link gets truncated with ellipses.
This is not an issue while using Safe HTML.
Controller using Safe HTML
- Select a build (e.g. #5)
- Edit Build Information link (left)
Description:<b>Commit</b>: [<a href="https://MY_BB_HOST/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits/0123456789abcdef0123456789abcdef01234567">abc123d</a>]
- Save button
- OBSERVE: build #5 shows clickable link:
Commit: [abc123d] // this IS a clickable link
- Navigate back to job
- OBSERVE: list of jobs, build #5 shows clickable link:
Commit: [abc123d] // this IS a clickable link
Controller using markdown
- Select a build (e.g. #5)
- Edit Build Information link (left) or Add Description button
- Description:
__Commit__: [abc123d}(https://MY_BB_HOST/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits/0123456789abcdef0123456789abcdef01234567)]
- Save button
- OBSERVE: build # 5 shows clickable link:
Commit: [abc123d] // this IS a clickable link
- Navigate back to job
- OBSERVE: list of jobs, build #5 shows:
Commit:... //NOT a clickable or readable link
- Hypothesis: It appears that the plugin truncates the Commit string based on actual length rather than rendered length.
- Workaround: Just use the commit prefix string WITHOUT the link. (But... I like the link.)
- Other markdown (e.g. bold) for short strings appears to work as expected in both build and job views.
FWIW, I find adding a Commit link to the build from the pipeline EXTREMELY useful if I am quickly iterating. I find myself being impatient and smashing build button shortly after pushing a change. This quick look allows me to see the commit version without having to click into the job. Only caveat is my sample only shows last commit version, but good enough for my use.
Pipeline snippet: somewhere in an early stage... before things start to break ![]()
script{
...
env.REPO_URL_COMMITS = "https://MY_BB.com/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits" // only shown here for example, I will usually set in environment{} block
env.COMMIT_URL_MD = "[Commit ${GIT_COMMIT[0..6]}](${REPO_URL_COMMITS}/${GIT_COMMIT})" // truncates commit version to 7 characters for display text
currentBuild.description = "${COMMIT_URL_MD}" // add commit URL to build description
//OPTIONAL: add useful debug/iterate comments to description (note the double trailing spaces for linefeeds)
//currentBuild.description = "${COMMIT_URL_MD} \n${MY_CUSTOM_MESSAGE} \n \n---"
...
}
environment
```
Jenkins 2.426.1
Markdown Formatter 95.v17a_965e696ee
```
6 attachments
- [2024-03-25_Mon_018.png](https://issues.jenkins.io/secure/attachment/62368/2024-03-25_Mon_018.png)
> 
- [build-view-not-truncated-with-markdown-formatter-1.png](https://issues.jenkins.io/secure/attachment/62363/build-view-not-truncated-with-markdown-formatter-1.png)
> 
- [build-view-not-truncated-with-markdown-formatter.png](https://issues.jenkins.io/secure/attachment/62364/build-view-not-truncated-with-markdown-formatter.png)
> 
- [build-view-not-truncated-with-safe-html.png](https://issues.jenkins.io/secure/attachment/62361/build-view-not-truncated-with-safe-html.png)
> 
- [job-vew-truncated-with-safe-html.png](https://issues.jenkins.io/secure/attachment/62359/job-vew-truncated-with-safe-html.png)
> 
- [job-view-truncated-with-markdown-formatter.png](https://issues.jenkins.io/secure/attachment/62360/job-view-truncated-with-markdown-formatter.png)
> 
Contributor guide
Research direction
Start in the markdown-formatter-plugin repository by reproducing the reported difference between the build and Job views with a markdown link containing a long URL; compare it with the Safe HTML behavior. The issue is done when the linked commit remains readable and clickable in the Job view without ellipses, while existing build-view behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100