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.
Discourse is now shipping an experimental WYSIWYG composer
This infra also makes it possible long term to apply syntax highlighting on markdown if we want to go down that path, it becomes a lot less necessary though with the new composer.
For example the new composer now allows you to apply syntax highlighting to code while you are typing it!