Discussion:
Markdown in tickets
(too old to reply)
Andy Goth
2018-06-26 15:53:40 UTC
Permalink
Is there a reason why Fossil tickets don't allow markdown? The format
options are wiki, HTML, plain text, and [links only].
--
Andy Goth | <andrew.m.goth/at/gmail/dot/com>
Richard Hipp
2018-06-26 16:05:51 UTC
Permalink
Post by Andy Goth
Is there a reason why Fossil tickets don't allow markdown? The format
options are wiki, HTML, plain text, and [links only].
Markdown as a formatting option can be added by configuration.

Perhaps you are asking for Markdown support to be added to the default
configuration?
--
D. Richard Hipp
***@sqlite.org
Andy Goth
2018-06-26 16:46:07 UTC
Permalink
Post by Richard Hipp
Post by Andy Goth
Is there a reason why Fossil tickets don't allow markdown? The format
options are wiki, HTML, plain text, and [links only].
Markdown as a formatting option can be added by configuration.
I apologize, I was unclear. When I was talking about Fossil tickets, I
was referring specifically to Fossil's own tickets, rather than tickets
in general. Right now I can't use Markdown when writing a ticket (or
comment thereto) against Fossil itself.
Post by Richard Hipp
Perhaps you are asking for Markdown support to be added to the default
configuration?
I don't see a reason to disable it by default.
--
Andy Goth | <andrew.m.goth/at/gmail/dot/com>
Chad Perrin
2018-06-26 18:56:59 UTC
Permalink
Post by Richard Hipp
Post by Andy Goth
Is there a reason why Fossil tickets don't allow markdown? The format
options are wiki, HTML, plain text, and [links only].
Markdown as a formatting option can be added by configuration.
Perhaps you are asking for Markdown support to be added to the default
configuration?
I am running Fossil v2.5 here:

$ fossil version
This is fossil version 2.5 [188a0e2904] 2018-02-07 18:48:14 UTC

I see no Markdown formatting option for tickets when visiting the web UI
via `fossil serve`:

Loading Image...

It only shows Wiki, HTML, Plain Text, and [links only].
--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]
Richard Hipp
2018-06-26 20:05:41 UTC
Permalink
Post by Chad Perrin
$ fossil version
This is fossil version 2.5 [188a0e2904] 2018-02-07 18:48:14 UTC
I see no Markdown formatting option for tickets when visiting the web UI
Go to /Admin/Tickets and edit the scripts you find there to provide
support for markdown. As the scripts already provide support for
text/plain, text/html, and text/x-fossil-wiki, it should be apparent
how to enhance them with an extra case for text/markdown.

Once you get this working, submit your changes for inclusion in the
SQLite source tree.
--
D. Richard Hipp
***@sqlite.org
Martijn Coppoolse
2018-06-27 09:33:57 UTC
Permalink
Post by Richard Hipp
Post by Chad Perrin
I see no Markdown formatting option for tickets when visiting the web UI
Go to /Admin/Tickets and edit the scripts you find there to provide
support for markdown. As the scripts already provide support for
text/plain, text/html, and text/x-fossil-wiki, it should be apparent
how to enhance them with an extra case for text/markdown.
Rendering the markdown is not quite that easy: all the existing options
use the "wiki" command, supplied with various incantations of the
<verbatim> tag. This doesn't appear to work for markdown.

Browsing the source code suggests there is a separate "markdown"
command, but that returns a list instead of actually rendering HTML,
like the wiki command does.
Post by Richard Hipp
Once you get this working, submit your changes for inclusion in the
SQLite source tree.
After some spelunking in th_language.c, here’s what I got working to
render the markdown. Setting the proper mimetype and including it as an
option is left as an exercise for the reader.

(...)
if {$mutype eq "Markdown"} {
set md [string trimright $icomment]
set md [markdown $md]
set title [lindex $md 0]
set body [lindex $md 1]
html "<h2>"
html $title
html "</h2>"
html $body
} elseif {$mutype eq "Wiki"} {
(...)

I’d never written TH1 (or Tcl) before, so it can probably be improved
upon — most notably skipping the <h2> if the title is empty, which will
usually be the case in a ticket — but it seems to work OK.
--
Martijn Coppoolse
Loading...