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

Support Markdown in Add-on Listing Fields #22956

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

chrstinalin
Copy link
Contributor

@chrstinalin chrstinalin commented Dec 20, 2024

Fixes: mozilla/addons#15145

Description

Replaces HTML syntax support with Markdown support in the description, developer_comments, eula, and privacy_policy fields of Addon. Existing HTML in those fields will remain functional until the field is edited. No new HTML will be functional.

Only the markdown-equivalent of currently allowed HTML attributes are allowed. abbr uses the PHP Markdown Extra syntax.

DevHub:

image
image
image

Frontend:

image
image
image

Testing

  1. Navigate to existing add-on that already has HTML in its description. The HTML should still be functional. The field is still formatted on the frontend listing.
  2. Under the 'edit' page, the description and developer comments should support markdown syntax.*
  3. Under the 'Manage Authors & License' page, the EULA and Privacy Policy fields should support markdown syntax.*

* Any user-inputted HTML saved at this point no longer works. Any markdown in the field is formatted in the frontend, and HTML is not.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

@chrstinalin chrstinalin marked this pull request as draft December 20, 2024 21:05
@chrstinalin chrstinalin marked this pull request as ready for review December 24, 2024 17:33
@chrstinalin chrstinalin requested review from a team and KevinMind and removed request for a team December 24, 2024 17:41
@chrstinalin
Copy link
Contributor Author

There should probably be a more informative way to explain what syntax or Markdown is supported, possibly similar to how GitHub explains it via the 'Markdown is Supported' button by navigating to a dedicated page.

Copy link
Contributor

@KevinMind KevinMind left a comment

Choose a reason for hiding this comment

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

Looks promising. A few comments before testing.

src/olympia/translations/models.py Show resolved Hide resolved
<p class="syntax-support">
{# L10n: %s is a list of markdown syntax. #}
<span class="tooltip" title="{% if title %}{{ title }}{% else %}{{
_('Allowed Markdown: %(allowed_markdown)s', allowed_markdown='links, abbr, bold, italics, blockquote, code, ol, ul')
Copy link
Contributor

Choose a reason for hiding this comment

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

allowed_markdown should be in a constant somewhere. If these are in fact the only tags allowed then use that same constant in actual processing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just since you pointed this out --

There should probably be a more informative way to explain what syntax or Markdown is supported, possibly similar to how GitHub explains it via the 'Markdown is Supported' button by navigating to a dedicated page.

I mentioned this to Andrew offhandedly as, especially with the extensions, it may not be obvious what Markdown syntax is allowed in what way, and he mentioned maybe making it a page on the extension workshop over the tooltip. What do you think?

src/olympia/devhub/templates/devhub/includes/macros.html Outdated Show resolved Hide resolved
src/olympia/translations/models.py Show resolved Hide resolved
@KevinMind
Copy link
Contributor

Please add testing steps and I can verify the PR.

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.

[Task]: Support markdown in add-on listing fields
2 participants