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

Do not convert the markdown PR description to HTML for bitbucket #6287

Merged

Conversation

stefangr
Copy link
Contributor

@stefangr stefangr commented Dec 9, 2022

Recently something changed in formatting the PR description, resulting in a mess of HTML where a nice description should be in bitbucket.

This PR changes the PR description from:
afbeelding

to:
afbeelding

@stefangr stefangr requested a review from a team as a code owner December 9, 2022 11:13
@stefangr stefangr force-pushed the bitbucket-convert-html-to-markdown branch from d0d297f to bb4eccc Compare December 19, 2022 16:35
@stefangr stefangr changed the title [Bitbucket] Convert HTML to Markdown Do not conver the markdown PR description to HTML for bitbucket Dec 23, 2022
@stefangr stefangr changed the title Do not conver the markdown PR description to HTML for bitbucket Do not convert the markdown PR description to HTML for bitbucket Dec 23, 2022
@jeffwidman
Copy link
Member

Sorry for the delay here.

So you're saying it used to work fine, then something changed and it stopped working? If so, do you know what change broke it here in dependabot-core?

I'm wondering if that change was unintentional, or maybe we upgraded a library that flipped a default setting w/o us realizing it. Because rather than special-casing BitBucket, in that case we might be able to set the value back to what it was previously which was working everywhere...

Also, can you squash history down to drop the changes from 5bc9df6? Since it looks like you backed those out in favor of flipping a config.

@stefangr stefangr force-pushed the bitbucket-convert-html-to-markdown branch from e01fa40 to dc511fb Compare January 7, 2023 09:18
@stefangr
Copy link
Contributor Author

stefangr commented Jan 7, 2023

I traced the change back to the upgrade of the dependabot-omnibus package from 0.212.0 to 0.214.0.

There I found this little change. Which is fine of course and should stay.

@jeffwidman
Copy link
Member

Oh yeah that makes sense. 😀

I'm on my phone now but should be able to review the code in detail this coming week.

@stefangr stefangr force-pushed the bitbucket-convert-html-to-markdown branch from dc511fb to 5db1258 Compare January 13, 2023 16:11
Copy link
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Oh man, you're making me glad I wasn't able to review this last week! 🤣

This PR just got cleaner/tidier as time went on. Nice job!

@jeffwidman jeffwidman force-pushed the bitbucket-convert-html-to-markdown branch from 5db1258 to d18568b Compare January 17, 2023 20:19
@@ -45,6 +45,8 @@ def sanitize_links_and_mentions(text:, unsafe: false)
sanitize_nwo_text(doc)

mode = unsafe ? :UNSAFE : :DEFAULT
return doc.to_commonmark([mode] + COMMONMARKER_OPTIONS) unless format_html
Copy link
Member

Choose a reason for hiding this comment

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

Actually, if we do this, it'll affect all providers that don't support html:

!%w(azure bitbucket codecommit).include?(source.provider)

That doesn't mean this is a bad way to go, but let me double-check if that list is still accurate... for example I already found #6453

Copy link
Member

@jeffwidman jeffwidman Jan 17, 2023

Choose a reason for hiding this comment

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

Let's go ahead and merge this, and then I'll open a follow-up PR to address #6453 and get input from Microsoft folks... I have a feeling that it now supports HTML, which would make our lives easy here. If not, we may need to refactor source_provider_supports_html into two separate methods, but that's beyond the scope of this PR.

@jeffwidman jeffwidman merged commit a563c04 into dependabot:main Jan 17, 2023
@stefangr stefangr deleted the bitbucket-convert-html-to-markdown branch January 18, 2023 05:41
jeffwidman added a commit that referenced this pull request Jan 18, 2023
While researching #6287 (comment),
I noticed that https://developercommunity.visualstudio.com/content/problem/608769/add-support-for-in-markdown.html
eventually leads to https://developercommunity.visualstudio.com/t/add-support-for-the-html-tag-in-markdown/609415#T-N1190213
which says that Azure ADO now supports the `<details>` tag in Markdown.

Furthermore, I suspect that ADO now fully supports HTML in PR
descriptions but it's not documented either way in https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/create?view=azure-devops-rest-7.0&tabs=HTTP#request-body.

So opening this PR as the simple solution. If ADO doesn't support HTML
but does support the `<details>` tag, then we'll unfortunately need a
more complex solution of refactoring things... but I hope not.

Fix #6453
jeffwidman added a commit to jeffwidman/dependabot-core that referenced this pull request Dec 16, 2023
While researching dependabot#6287 (comment),
I noticed that https://developercommunity.visualstudio.com/content/problem/608769/add-support-for-in-markdown.html
eventually leads to https://developercommunity.visualstudio.com/t/add-support-for-the-html-tag-in-markdown/609415#T-N1190213
which says that Azure ADO now supports the `<details>` tag in Markdown.

Furthermore, I suspect that ADO now fully supports HTML in PR
descriptions but it's not documented either way in https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/create?view=azure-devops-rest-7.0&tabs=HTTP#request-body.

So opening this PR as the simple solution. If ADO doesn't support HTML
but does support the `<details>` tag, then we'll unfortunately need a
more complex solution of refactoring things... but I hope not.

Fix dependabot#6453
jurre pushed a commit to jeffwidman/dependabot-core that referenced this pull request Dec 19, 2023
While researching dependabot#6287 (comment),
I noticed that https://developercommunity.visualstudio.com/content/problem/608769/add-support-for-in-markdown.html
eventually leads to https://developercommunity.visualstudio.com/t/add-support-for-the-html-tag-in-markdown/609415#T-N1190213
which says that Azure ADO now supports the `<details>` tag in Markdown.

Furthermore, I suspect that ADO now fully supports HTML in PR
descriptions but it's not documented either way in https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/create?view=azure-devops-rest-7.0&tabs=HTTP#request-body.

So opening this PR as the simple solution. If ADO doesn't support HTML
but does support the `<details>` tag, then we'll unfortunately need a
more complex solution of refactoring things... but I hope not.

Fix dependabot#6453
jakecoffman pushed a commit that referenced this pull request Dec 19, 2023
While researching #6287 (comment),
I noticed that https://developercommunity.visualstudio.com/content/problem/608769/add-support-for-in-markdown.html
eventually leads to https://developercommunity.visualstudio.com/t/add-support-for-the-html-tag-in-markdown/609415#T-N1190213
which says that Azure ADO now supports the `<details>` tag in Markdown.

Furthermore, I suspect that ADO now fully supports HTML in PR
descriptions but it's not documented either way in https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/create?view=azure-devops-rest-7.0&tabs=HTTP#request-body.

So opening this PR as the simple solution. If ADO doesn't support HTML
but does support the `<details>` tag, then we'll unfortunately need a
more complex solution of refactoring things... but I hope not.

Fix #6453
jakecoffman pushed a commit that referenced this pull request Dec 19, 2023
* Azure DevOps now supports HTML in PR descriptions

While researching #6287 (comment),
I noticed that https://developercommunity.visualstudio.com/content/problem/608769/add-support-for-in-markdown.html
eventually leads to https://developercommunity.visualstudio.com/t/add-support-for-the-html-tag-in-markdown/609415#T-N1190213
which says that Azure ADO now supports the `<details>` tag in Markdown.

Furthermore, I suspect that ADO now fully supports HTML in PR
descriptions but it's not documented either way in https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-requests/create?view=azure-devops-rest-7.0&tabs=HTTP#request-body.

So opening this PR as the simple solution. If ADO doesn't support HTML
but does support the `<details>` tag, then we'll unfortunately need a
more complex solution of refactoring things... but I hope not.

Fix #6453

* Add a test on azure sources

---------

Co-authored-by: Barry Gordon <brrygrdn@github.com>
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.

2 participants