Would it be hard to replace the default post editor textarea
by a markdown syntax highlighter?
Or am I missing the option somewhere?
You have already beautifully implemented this for css in the admin styles editor:
Would it be hard to replace the default post editor textarea
by a markdown syntax highlighter?
Or am I missing the option somewhere?
You have already beautifully implemented this for css in the admin styles editor:
Isnât that already achieved by using the code block, which gives you syntax highlighting in the preview area?
This is an interesting idea, the goal would be to have syntax highlighting in the textarea (i.e. the left side of the composer) so you could see if youâre making any markdown syntax mistakes. Yes, code blocks do the same in the preview, but you wonât see any markdown mistakes, for example. And some complex markdown would be easier to scan, post with lots of tables, uploads, links, headings.
Iâm not sure itâs easy to do this, though. Our admin screens use the ACE Editor, and I donât think we can just drag and drop that on the post composer.
Yes, this is exactly my use case.
It gives a very direct feedback about your syntax: you donât have to look to the right pane every other second to check if you arenât making trivial syntax mistakes.
It would give a bit more structure for those who are less apt in Markdown (any beginner).
Of course you still have the rendered html on the right side of the composer window.
I would see no immediate disadvantages to this, especially if itâs an option.
PS: Apparently thereâs not even a Markdown syntax highlighter installed for codeblocks :
# Markdown codeblock's syntax...
... unfortunately ...
- isn't
- highlighted
**at all**!
EDIT 2 hrs later: Fixed by @pmusaraj
Oh, good catch! Looks like weâre missing some styles for the markdown highlighter.
Using a full blow editor for âjustâ markdown isnât a bit too much?
In my opinion, using a markdown semi-wysiwyg is more aligned to the OP needs, like for example https://ui.toast.com/tui-editor, Playground | Milkdown, etc.
Those two look great!
However, I could imagine that the simpler Milkdown would be better suited since itâs okay if the editor gives a more âunderwater screenâ[1] feel, as youâve got the preview on the right anyway.
Yes I vividly remember WordPerfect âŠď¸
Yeah, any one of ACE, TUI, Milkdown is a very big change, they all would need to replace the textarea with contenteditable
. Worth an experiment, for sure, but in core itâs a big project.
PR is up with a fix for the missing markdown highlighting: UX: Update highlight.js styles by pmusaraj ¡ Pull Request #23999 ¡ discourse/discourse ¡ GitHub
Just to expand, first that this is something I really want core to support but also worth expanding on the complexity.
Discourse core uses many many APIs against TEXTAREA directly, @mentions
, toolbar inserts stuff into the TEXTAREA, uploads, cut and paste images and more.
This is all not abstracted away and assumes it is talking to a TEXTAREA. Adding a contenteditable there direct would mean it would need to also properly and very accurately simulate a TEXTAREA, something that is likely to fail. We need a fair amount of work to create some sort of provider framework so we can swap things in.
See also:
Highlighter is certainly a great first move in this direction cause you donât have to worry about bi-directional markdown to text mapping.
There may be some ninja hack where you can hide the TEXTAREA and then render a contenteditable on top of it, ferrying events to the original, but even that would require a re-implementation of @mention
positioning.
I must be honest here: now that Iâve seen the Trello editor, Discourse feels a bit 2000âs on the editor front:
It think this sort of thing is important.
Note: It is still 100% accepts Markdown syntax.
Personally not a fan of this. Itâs far too cluttered. I love that the editor in Discourse is visually clean. All I really see is text, and the rendered stuff is out to the side where it belongs.
Back to the main point of syntax highlighting though, this is something I would also love to see. At the very least I would love # Headings and ## Subheadings to be highlighted in some way. I canât tell you how often I search through my longer posts, where the preview and editor are misaligned, and it takes me ages to find where my related # heading is.
For me just making # Headings bold, or a particular colour in the editor side of the composer would be a massive improvement.
It is, isnât it?
These editors are made for devs and coders and are really confusing for ordinary ones.
But it is what it is and is too deep in the core to change. Like draft question
Anyway â off topic etc.
Is this any closer to happening?
Context:
We have started work in this area @lindsey will share information as we progress
This is very good to hear - using markdown is great for our power users, but quite a learning curve for the majority of our less-than-super-users and would go a long way to making our community more accessible.
Hey @lindsey, I donât want to rush you in any way, but I thought I might just ask if you were able to share the following:
Whether the changes will include interoperability / a framework to allow plugins to develop editor solutions.
Relatedly, whether youâre looking at developing your own rich text editor, e.g. in a plugin.
A rough sense of what timeline youâre looking at for 1 and / or 2.
The context for me is the approach to and timeline of this potential project
@Rohail_Altaf and I are attempting to think about how best to approach this, particularly timeline wise. Nevertheless, I completely understand if youâre not able to share that at this stage.
Hey Angus â sorry for the delay here, weâve been out at our companyâs annual retreat in Tokyo!
I canât answer with too many specifics right now as weâre still nailing down implementation details. I think we should have that figured out in the coming weeks, at least well enough to answer these questions, so Iâll check back in once we know more.