Discourse Mark Plugin

discourse-mark

Repository: GitHub - sirideain/discourse-mark: Adds highlighting to Discourse

Features

  • Adds an editor option to highlight text.

Usage

You can wrap text with == to highlight it.

==Highlighted Text==

Installation

Known Issues

  • None

Future

  • Update icon to highlighter once Font Awesome 5 is available
27 Likes

This is already sort of possible in default Discourse with HTML tags

inserted text and deleted text

<ins>inserted text</ins> and <del>deleted text</del>

Not quite the same as “highlighted” but a very similar effect at least for <ins>

10 Likes

I think @sirideain put this together following this thread: Discourse CommonMark text highlighting?

2 Likes

Yes totally fine, just pointing out there’s an alternative “sort-of” way to do this built in. I don’t think Commonmark even specifies highlight as part of the standard…

1 Like

I think they’re fundamentally different things though? Insertions and deletions may be used in parallel with highlighting.

That’s a very literal reading. If I was to tell you I just highlighted this text how would anyone reading even know any different? Particularly if I changed the CSS to whatever color and style I liked…

2 Likes

Highlighting indicates areas for attention, insertions and deletions indicate change.

Sure, we can use CSS to restyle elements, we could also for example set background-color on anything within <strong> tags, but then we would lose the ability to make things bold without also highlighting them. The plugin lets us highlight passages without losing differentiation between the styles associated with tracked changes. Being a totally optional plugin which expands upon a well-established convention I don’t see tremendous value in confusing the two.

1 Like

It is not part of the commonmark spec, that is for sure.

It would be great if this followed other common Markdown highlight syntax. I’m not sure if it’s in a particular spec (a quick Google search didn’t yield anything), but popular Markdown apps with the highlight feature use double colons to enclose text, like so:

::Highlighted Text::

Love the idea though!

2 Likes

Discourse is using markdown-it for parsing markdown. I am bundling the markdown-it-mark plugin so it is available in Discourse. Support for this syntax would need to be added there.

5 Likes

I installed this, and the ==text== highlighting works, but the Highlight Text option does not show up in the gear menu.

Curiously the Green Tick does not show next to the plugin either:

but I don’t know if that is related.

The green tick will only appear next to official plugins that are supported by the core discourse team, to distinguish them from 3rd party plugins.

6 Likes

There was an issue where the highlighting was not respecting the enable setting, but the gear menu option was. This has been fixed now.

This plugin appears to break posting in Discourse 2.6. At least, posting failed with error 500 until I removed this plugin and rebuilt my forum.

I just tested with a fresh install of 2.7 beta1 and it seems to be working correctly. What other plugins do you have installed? Is there anything in the Discourse logs?

See:

It is possible the rebuild was all that was required, though the error logs do mention markdown.

The other plugins are all Discourse first party ones.

I tried adding in the other plugins you listed and I was not able reproduce the issue.

I am not surprised the logs listed markdown as that is used for all formatting in Discourse posts. I didn’t see any mention of this plugin in the logs you posted.

What happens if you add the plugin back in and rebuild again? I think your idea that it was the rebuild is accurate.

I will try that and get back to you. I might not be able to get it done today, I need to do it when I have some time to track it carefully.

Thanks for the feedback.

I reinstalled the mark plugin and everything seems fine, so some combination of removing the plugin and rebuilding resolved the inability to post, and reinstalling the plugin and rebuilding did not return to the failure state.

Who knows what that means, but I’m happy to have the plugin back.

Thanks.

Is there a way to add styling shortcuts to the Post editor’s toolbar? There are a number of tags that would improve the comprehension of technical topics. But newbies, on the other hand, are frustrated by the austerity of the Discourse toolbar.

Perhaps we could have toolbar options for a few Markdown tags we can use to make our posts more readable. Your example of Insert & Delete are very practical. This plus the keyboard button tag already clarify our postings by experienced regulars.

And since we are doing community-powered software support, a customizable emoji group (floated to the top/default) would be helpful. (We’d add a technology emoji group.)

inserted code : <ins>inserted code</ins>
deleted code : <del>deleted code</del>
marked text : <mark>marked text</mark>
Keyboard keys Ctrl+k : <kbd>Ctrl</kbd>+<kbd>k</kbd>

Technology emojis include input devices like the mouse & keyboard.
:computer_mouse: Computer Mouse

4 Likes