Bug 406366 - Markdown addon: please add support for --github-checkbox
Summary: Markdown addon: please add support for --github-checkbox
Status: REPORTED
Alias: None
Product: kdepim
Classification: Applications
Component: messagecomposer (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-09 15:26 UTC by avlas
Modified: 2019-04-16 21:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description avlas 2019-04-09 15:26:44 UTC
Right now Markdown addon in Kmail shows this issue https://github.com/Orc/discount/issues/187

This has been fixed (Discount 2.2.4 documentation):

(feature) support github checkbox list items (static configuration option)
--github-checkbox does the checkbox with html check entities
--github-checkbox=input does them with html <input> elements (set to disabled so that people can’t check and uncheck willy-nilly)
Comment 1 Laurent Montel 2019-04-09 15:50:47 UTC
Hi,
it's a configure option to discount.
But I use discount lib, I don't rebuild it.
It's not a flags in lib.
So we can't do it or I missed something
Comment 2 avlas 2019-04-09 16:13:19 UTC
(In reply to Laurent Montel from comment #1)
> Hi,
> it's a configure option to discount.
> But I use discount lib, I don't rebuild it.
> It's not a flags in lib.
> So we can't do it or I missed something

Mmm, I asked about it, but I think you're right (https://github.com/Orc/discount/issues/187#issuecomment-382942705):

"I can't use another MKD_ flag without breaking the published interface, because the flags are stored in a 32 bit integer and I've already got 32 of them defined. So for the short term it's gotta be configured with the --github-checkbox option to configure.sh"
Comment 3 avlas 2019-04-15 13:03:23 UTC
This is set by default now in Discount v3 branch, which is great. An example of this is the following:

### This is my list:

- [x] this is set
- [ ] this is not
- and this is a regular list item.

However, to make it work as expected (i.e. removing dots from the checkboxes and aligning) it requires:

- either adding to the file/email:

<style>
.github_checkbox { list-style-type: none; margin-left: -1.5em; }
</style>

this option works when converting via: markdown -style < checkbox.md > checkbox.html

- or (much better option) to create a css file with:

.github_checkbox { list-style-type: none; margin-left: -1.5em; }

this option works when converting via: mkd2html -css checkbox.css checkbox.md

Do you think it be possible to add an option to set a css for mkd2html conversion (and perhaps add this by default), so that the final user doesn't have to be aware, neither repeat this for every email? 

The css option could also be interesting for:

- styling code highlighting?

- table/blockquote format

[I opened issues in Discount regarding the style of tables and blockquotes. I hope this will be considered to look similar to github/markdown here. if so, I will let you know].
Comment 4 Laurent Montel 2019-04-15 17:39:40 UTC
v3 branch ?
Comment 5 avlas 2019-04-15 22:41:30 UTC
(In reply to Laurent Montel from comment #4)
> v3 branch ?

I meant in the v3 branch of discount: 

https://github.com/Orc/discount/tree/v3

By the way, discount works great with css files. I got a github style css file that makes markdown html conversion look great (tables, blockquotes, etc), IMO far better than just plain markdown. 

Blockquotes are particularly important for email replies.

Would you consider adding the possibility of styling via a css file in Kmail's markdown addon? I think this option would be very appreciated by its users.
Comment 6 Laurent Montel 2019-04-16 11:52:25 UTC
adding a css to generate file is not a problem but how told to Discount lib that we want to generate tables with specific css ?
Comment 7 avlas 2019-04-16 12:00:08 UTC
(In reply to Laurent Montel from comment #6)
> adding a css to generate file is not a problem but how told to Discount lib
> that we want to generate tables with specific css ?

I just explained it in another (related) issue: https://bugs.kde.org/show_bug.cgi?id=406334

Please let me know if you would encounter any problem
Comment 8 avlas 2019-04-16 12:06:56 UTC
(In reply to Laurent Montel from comment #6)
> Discount lib

Mmm, I didn't realize you meant the lib, but makes total sense. I don't know, will ask Discount dev...
Comment 9 avlas 2019-04-16 12:30:58 UTC
(In reply to avlas from comment #8)
> (In reply to Laurent Montel from comment #6)
> > Discount lib
> 
> Mmm, I didn't realize you meant the lib, but makes total sense. I don't
> know, will ask Discount dev...

May it be using the following function?

int mkd_css(MMIOT *doc, char **out) allocates a buffer and populates it with any style blocks found in the document.

I asked Discount Dev to confirm...
Comment 10 avlas 2019-04-16 21:12:11 UTC
(In reply to avlas from comment #9)
> (In reply to avlas from comment #8)
> > (In reply to Laurent Montel from comment #6)
> > > Discount lib
> > 
> > Mmm, I didn't realize you meant the lib, but makes total sense. I don't
> > know, will ask Discount dev...
> 
> May it be using the following function?
> 
> int mkd_css(MMIOT *doc, char **out) allocates a buffer and populates it with
> any style blocks found in the document.
> 
> I asked Discount Dev to confirm...

This is what I got from Discount Dev:

Discount sweeps up `<style>` blocks (unless you set MKD_NOSTYLE, which I presume is not being done here) and returns them, yes.   But style blocks go in the header section of a html document, so the way that the markdown program (main.c) does it is a good reference:

            if ( mkd_compile(doc, flags) ) {
                if ( styles )
                    mkd_generatecss(doc, stdout);
               if ( content )
                    mkd_generatehtml(doc, stdout);
           }

(With, of course, the caveat that the style blocks go in the header of the document)
Comment 11 avlas 2019-04-16 21:13:51 UTC
And unfortunately:

    "You can't sensibly pass a css file to the library, because non-inline css is handled in the document header and markdown formats the contents of the document body."

and wondering... I assume that it would not be proper to use mkd2html directly, right?