Proposal: Feature: Markdown preview for markdown-supported fields #260
No reviewers
Labels
No Label
Priority
Critical
Priority
High
Priority
Low
Priority
Normal
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Type
Breaking
Type
Documentation
Type
Enhancement
Type
Feature
Type
Report
Type
Security
Type
Suggestion
Type
Testing
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: infrastructure/extensions-website#260
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Francesco-Bellini/extensions-website:markdown-preview"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
To succeed in writing markdown for descriptions, release notes, review comments, can be challenging from the textarea, without a reference.
While in description and changelogs we are able to amend the errors or adjust the markdown by updating, in comments it's not possible (at least for now, afaik).
In either case, having a quick preview of the markdown would be useful to prevent useless updates or bad-format comments. Also, after approval, editing descriptions creates review comments, which is not optimal in case of multiple simple markdown/typos fix edits which could be avoided with a better look.
My Proposal
Screenshots avaliable; scroll down
Use a [Gitea, GitHub, etc]-like tabs system for markdown preview (like in this page comments). A classic.
A couple of tabs on top of the textarea: Write | Preview ; using styling that fits the platform.
A very minimal API to process the input text using the same
render()
function used by the|markdown
pipe from templates.JS script to handle tabs switch and markdown fetch, client-side
The script also takes care of the following cases:
In a normal case, the API should respond in a blink.
More details
To recognize markdown fields from
field.html
template, I created a simple filteris_markdown_field
, to check if thefield.name
matches one of the markdown fields.The id of the new elements involved use as a suffix the
field.name
. This way, multiple textareas on the same page, are handled independently by the script (like in the post-upload page, with description and first changelog on the screen)Styling:
To be consistent, tabs use the
hero-tabs
andis-active
classes and HTML structure.This matches the style of the tab-bars on the platform.
I used the generic class
style-rich-text
, like extensions description, which seems to work fine, even though various markdown elements (comments, changelog) uses different classes structure, but the result seems to look the same.Images of the result
Description:
Approval-queue comments:
Release notes:
Style match:
A mention of markdown preview is made in infrastructure/extensions-website#243.
I'm available for any kind of changes that might be necessary. From my testing, everything looks good!
I wasn't familiar with the Django framework and I'm pretty new to this project, so I tried to look around and search in order to try to blend well in the code.
15118f16d7
to1877cbc936
Checkout
From your project repository, check out a new branch and test the changes.