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

Convert plaintext URLs in project descriptions to hyperlinks #616

Closed
1058274 opened this issue Feb 13, 2023 · 3 comments · Fixed by #618
Closed

Convert plaintext URLs in project descriptions to hyperlinks #616

1058274 opened this issue Feb 13, 2023 · 3 comments · Fixed by #618

Comments

@1058274
Copy link
Contributor

1058274 commented Feb 13, 2023

One-sentence description

Obvious plaintext URLs in project descriptions should automatically be detected and converted to HTML hyperlinks.

Desired functionality

Currently, project descriptions can not be set in any way to present URLs as HTML hyperlinks due to HTML character encoding. Superusers should be able to set a plaintext project description containing URLs where the URLs get converted to HTML hyperlinks in the front-end. This way, page visitors can directly visit a page mentioned in the project description using a single click.

Motivation

Nitpicking, perfectionism, and user experience.

Suggested implementation

  • Use Django's built-in filter urlize to convert obvious URLs to HTML hyperlinks here.
    • Obvious URLs because example.nl does not get converted but www.example.nl and https://example.nl do.
  • A superuser of the current production website should remove the HTML code from the current project descriptions for the projects Chemrade Plant dashboard and PUC Mathematics scavenger hunt. This step is not directly related to this repository, as it is likely a configuration mistake.
  • Optionally but probably redundant, use Django's striptags to remove any HTML as a preprocessing step. When used in combination with urlize, the current production website would have displayed proper hyperlinks. However, I think this step is not necessary if the user setting the project descriptions is aware that HTML can not directly be embedded in project descriptions.
@JobDoesburg
Copy link
Contributor

I would suggest implementing an HTML field with TinyMCE as done in https://github.com/svthalia/concrexit

@1058274
Copy link
Contributor Author

1058274 commented Feb 13, 2023

I would suggest implementing an HTML field with TinyMCE as done in https://github.com/svthalia/concrexit

I had a look at TinyMCE's HTMLField and it looks like a better solution indeed, as it allows the admins to customize the project description in different ways and to preview the project descriptions in realtime instead of having to rely on some conversion from urlize that only gets applied after saving.

Other than hyperlinks, what other styling features should be allowed in the editor? Also, the output should go through a bleach tag that has been configured based on the predetermined allowed styling features, similar to how it has been implemented @ Thalia, correct?

@JobDoesburg
Copy link
Contributor

Other than hyperlinks, what other styling features should be allowed in the editor? Also, the output should go through a bleach tag that has been configured based on the predetermined allowed styling features, similar to how it has been implemented @ Thalia, correct?

Maybe strong or italic text would be nice too, as well as uls and ols. I think the set Thalia implemented is very well thought-through so I propose to just copy it from them :)

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 a pull request may close this issue.

2 participants