WIP: Feature: Markdown preview for markdown-supported fields #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "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:
Review-process comment:
Release notes:
Style match test:
A mention of markdown preview is made in the issue infrastructure/extensions-website#243.
I'm available for any kind of changes that might be necessary. From my test, everything was fine!
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.
WIP: Feature: Markdown preview for markdown-supported fields.to WIP: Feature: Markdown preview for markdown-supported fields5bfbc4e3af
toab069f8d5e
ab069f8d5e
to4491559e93
4491559e93
tof24cbdab7a
f24cbdab7a
tobd5768d2cf
bd5768d2cf
to07962d9db2
07962d9db2
toc30a6e22b2
c30a6e22b2
to59f467c494
59f467c494
to4228e9a9f5
4228e9a9f5
to0bf7f7d813
0bf7f7d813
to8429f36428
8429f36428
toc200e78798
c200e78798
tocecb3631da
cecb3631da
to71bfd668da
71bfd668da
to7007189dd1
7007189dd1
to969297ac62
969297ac62
to4a2eba5514
4a2eba5514
to15118f16d7
Pull request closed