Treatment of Discourse e-mails:
- Transform BB quotes into mail citations.
- Syntax highlight fenced code blocks.
- Fill non-code paragraphs.
- Prettify links.
- Add user profile links to
@user
mentions. - Prettify the Previous Replies section.
Here's how citations and the previous replies section look:
Before | After |
---|---|
![]() |
![]() |
It looks even better combined with Nice Citation: screenshot.
And here's how fenced code blocks look:
Before | After |
---|---|
![]() |
![]() |
Note: The default highlighting assumes a dark theme. If your theme is
light, you'll certainly need to customize the faces in group
discourse-article
.
discourse-article
only applies its treatments to articles coming from
Discourse forums. This is determined using regexes in customizable
variable discourse-article-from-regexps
: if the From
header of an
article matches any of these regexes, the article is deemed to be a
Discourse article.
Discourse e-mails may contain quotes (citations) of the form
[quote=\"AUTHOR,...\"]...TEXT...[/quote].
This module replaces such quotes with regular e-mail citation format as follows:
AUTHOR wrote:
> ...TEXT...
> ...TEXT...
> ...TEXT...
and highlights the whole with face gnus-cite-1
.
When used in combination with Nice Citation (to get even nicer looking citations), the Discourse Article treatment must appear before the Nice Citation treatment -- see Usage below.
Fenced code blocks, which are delimited by triple backticks (```) are moved into their own paragraph and syntax-highlighted by markdown mode.
Syntax highlighting can be disabled by setting
discourse-article-highlight-code-blocks
to nil.
Non-code, non-preformatted paragraphs are fill-wrapped to fill-column
columns.
This is disabled by default, because currently it will likely mess up
itemized lists. It can be enabled by setting
discourse-article-fill-paragraphs
to t.
It prettifies Discourse links of the form [label](url)
by keeping only
the label, highlighted with the link
face and by making it
clickable. Clicking it follows the specified URL.
It also adds a link to a user's profile when it encounters a user name
in the form @user
.
If in your Discourse Emails settings you enabled to include "previous replies" at the bottom of each e-mail you receive, then this prettifies that section a bit.
It adds separators between replies and highlights the names of the
replies' authors. The face used to highlight the user names can be
customized with discourse-article-user-face
.
Copy discourse-article.el
into a directory that appears in your
Emacs' load-path
.
Simply require the module in your Emacs initialization file (Typically
~/.emacs
or ~/.emacs.d/init.el
):
(require 'discourse-article)
In case you want to apply the nice-citation
treatment too, require it
after discourse-article
:
(require 'discourse-article)
(require 'nice-citation)
M-x customize-group discourse-article
.
- Until the
upload://
links in plain text are fixed 1, write hack to replace theupload://
URLs with the actual URLs to the asset