-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkboxes and TOC aren't correctly rendered #27
Comments
No, I don't think you're missing anything, it's just incomplete. The table of contents isn't something I've implemented, and I'm not actually sure how that works at all. On my own wiki I just have an index page and link off from that, TOC sounds useful though.
Short answer though: No, the gem doesn't currently do any of this. I think we'd have to be careful how to integrate checkbox fanciness, might need to be a config option so as not to break existing implementations (or bump the gems version I guess, hurrah for being forever pre 1.0 ;). I'm unliklely to make time in the near-term to look at this, but, PRs are always welcome if you feel like having a go! just playing
|
Interesting, that the above list gets translated into <ul class="contains-task-list">
<li class="task-list-item enabled"><input type="checkbox" id="" class="task-list-item-checkbox" checked=""> what happens with a regular comment outside of a gollum wiki</li>
</ul> we probably could/should be doing that. |
I'm noticing that the html generated by vimwiki for the default syntax of checkboxes goes well along with the style.css lines as follows: I can confirm by inspecting the body that the list comes with Same portion using this gem and the corresponding suggested config: I haven't dug further, as this is only a suspicion resultant from trial and error. Getting late here in CEST, might look a bit more on this tomorrow, unless you see an obvious fact that I'm overseeing. This seems like the HTML style isn't being propagated as it should |
Yeah, it has been a while since I looked at it, but, vimwiki_markdown/lib/vimwiki_markdown/wiki_body.rb Lines 25 to 26 in b34a9b7
I assume there's a pipeline which can be used to give the same list classes, it's just not being done. That may be a quick and easy fix. So, it's not that the HTML style isn't being propagated so much as it's not even attempting to translate it into the github flavoured html. |
Adding the tasklist support as described in your comment above was trivial, as expected. I issued a PR for that. Unfortunately, this tells me that this was not exactly what I was expecting 😅 (you'd notice that I'm still getting to know what vimwiki, in general, does, and all the bells and whistles around it). The internal HTML translator from vimwiki has a rather neat system for different completion states, changing the HTML tag accordingly: This tag can then be customized with an additional style sheet using this 5-states (or 6 if you count My first thought was to create another extension in a commonmarker fork that implements the vanilla vimwiki functionality, and then call the forked gem in vimwiki_markdwon, but then I wondered if it's worth the effort, given that this is not in the spec of commonmarker: regardless of how easy that framework makes the introduction of the extension, It probably won't get merged there. So... after issuing the PR here, I probably advocate not to use that and have an internal parsing for the |
Fancy! I had no idea about the 6 different states a checkbox can have. I'm definitely a simple boolean person at heart :) Do you find you use the 6-state checkboxes? I mean, I'm totally happy to just deploy the existing quick fix - like I said - I'll actually use it myself quite happily. Shame really, simply tweaking the commonmarker option was super simple and works really nicely! Nice work finding the option, I've found that code not the most fun to read through. It'd be interesting to know how many people are using the 6-state checkboxes and whether it was worth trying to implement it. Still, if you're happy to implement it and write some tests for it, I'm happy to merge it in. |
Another thought, I do say with the gem that it's rendered using Github Flavoured Markdown... so, maybe it's legit (even preferable) to just use the simple boolean checkbox. That said, I'm happy to be persuaded. I guess the |
In terms of rendering it will do what you are mentioning, yes. Actually, with the PR above we would be strictly using only GitHub Flavoured Markdown. The 6 states are more an indication of completion over nested task lists, as follows (see https://github.com/vimwiki/vimwiki/blob/master/doc/vimwiki.txt#L1807)
But the user will only either check or uncheck, making it effectively boolean. The difference is in the generated HTML, however. If someone uses nested tasklists in their vimwiki, the markdown will generate this multi-state in their text editor. However, with the These Markdown lines (notice that
Results in this rendering with commonmark: Additionally, although not cool, vimwiki supports tasklists using asterisks or plus as well. The rendering using asterisks is slightly different:
This is because <li>
<p>[.] This is a parent line 2</p>
<ul>
<li>
<input type="checkbox" checked disabled> This is a child line 1</li>
<li>
<input type="checkbox" disabled> This is a child line 2</li>
<li>
<input type="checkbox" disabled> This is a child line 3</li>
</ul> Ideally, and this is what I'm mentioning, the So there's a bit of collision there, as I'd agree that GitHub flavored markdown shouldn't necessarily support this. But, then, it imposes a limitation on out-of-the-box vimwiki features (which is what I meant in the PR) |
I haven't looked at it, but, rather than forking What do you think? |
I just hacked together a different approach, which you can see in #29 The idea there is to enrich the list class to imitate the generated from vimwiki for wiki extensions. I took the style from there as well and added it to the This doesn't work along with the Please let me know what you think about this. Going the #29 way would be more similar to what vimwiki provides, which isn't GitHub flavored per se. |
BTW I just got the CI feedback which I'll happily deal with after your feedback as well. This is my first time writing in ruby, so please apologize for the idioms and mistakes 😅 I was having some issues with the |
Hi,
This might be more a request for clarification, as it might as well be that I'm just using this gem wrong:
I just stumbled upon this after tweaking with vimwiki for a couple of weeks. I was using Gollum until now with fairly good results, but there's no support for table of contents there, which is a bummer.
I'm uncertain if there's such support here, but I do see in the changelog that there has been work done in that direction. However, with a vanilla configuration just as the one stated in the README.md I see my markdown links for the TOC as plain text. Is this expected?
Also, as the syntax used for the markdown is the GitHub enriched, I was also expecting the checkboxes to be rendered, but that is not the case. Is it also expected or am I missing a configuration step?
Thanks!
The text was updated successfully, but these errors were encountered: