#3442 Don't render a Markdown heading when tagging another ticket number in comment field
Closed: Duplicate 5 years ago Opened 5 years ago by jflory7.

Summary

Don't render the start of a new line as a Markdown header if it is immediately followed by a reference to another ticket / PR in the project

Background

Sometimes in a comment, I will start a new line by mentioning another ticket:

#100 is where we added this feature. Lorem ipsum bar foo ipsum…

If #100 is at the beginning of the line, the following paragraph is rendered as a Markdown header level 1, making the paragraph too large and out of proportion to other text. This can be tricky when having conversations that cross-reference other tickets or PRs.

Details

The easiest way I would guess to do this is to run a simple check for all comment text. If a new line begins with # symbol and is immediately followed by an integer with no whitespace, do not render this line as a Markdown header.

I'm guessing on the logic, but I would imagine something like this is the easiest way of doing it.

Outcome

More intuitive cross-references to other issues / PRs in a project and less work for project maintainers to go back and edit fields when someone unknowingly does this and makes a huuuuuuge comment in the issue / PR


I pretty sure @adamw had fixed this not long ago. Need to look into it.

Metadata Update from @pingou:
- Issue tagged with: bug

5 years ago

Yeah, I believe I fixed this in https://pagure.io/pagure/pull-request/2994 . But note, it only works if the referenced issue/PR really exists, and in the same project.

Weird, I'm not sure how I hit this if it is fixed – I will go back to another issue in a specific repo to test soon

Yeah, if you could cite a specific case of this happening, maybe I could figure out why it's still happening. My best guess is that you/whoever just mistyped the issue/PR number and hit one that doesn't exist - in that case the text is still (intentionally!) treated as a section header.

@jflory7 let us know if you managed to reproduce it :)

I conveniently tried this in #3470 but didn't notice it. If I see it again, I will comment back. It might have been an older comment before this change was implemented, and I remembered to file a bug after this was implemented. :grinning:

Can probably close this as a duplicate.

Let's close it then and re-open if it happens again :)

Thanks for the report though @jflory7, always appreciated :)

Metadata Update from @pingou:
- Issue close_status updated to: Duplicate

5 years ago

Login to comment on this ticket.

Metadata