nilsnolde / wordpress-markdown-git

:loop: WordPress plugin to add file content (Markdown, Jupyter notebooks) from a Git based VCS to a WordPress post; replaces https://github.com/gis-ops/md-github-wordpress
GNU General Public License v3.0
48 stars 14 forks source link

Support for checkbox [x] #25

Closed PrzemyslawKlys closed 3 years ago

PrzemyslawKlys commented 3 years ago

Versions Wordpress: 5.7 Documents for Git: 1.1.0

Describe the bug

Currently if person uses:

Only UL/LI is respected, and [x] is written down as standard text.

Paste the shortcode and the censored contents of config.json

shortcode

config.json

To Reproduce Steps to reproduce the behavior:

  1. Create List
  2. Insert checkbox into the list
  3. Only List is recrated and checkbox is copied as is

Expected behavior

I would expect some sort of replacement to be used, emoji or an icon (☑)

Screenshots

image

Keep in mind that my theme doesn't show UL/LI properly, but other themes do

Additional context

nilsnolde commented 3 years ago

tl;dr: this plugin can't render Github's extended Markdown syntax..

I think you got a little too used to Github markdown convenience;) That's extended syntax and, among other things, needs some JS to function properly. This plugin simply asks Github's markdown API for the HTML of your raw markdown files and returns that to Wordpress unaltered.

For

Currently if person uses:

- [x] Test
- [ ] Test2

with this curl

curl --location --request POST 'https://api.github.com/markdown/raw' \
--header 'Accept: application/vnd.github.v3+json' \
--header 'Content-Type: text/plain' \
--data-raw 'Currently if person uses:

- [x] Test
- [ ] Test2'

you'll get

<p>Currently if person uses:</p>
<ul>
    <li>[x] Test</li>
    <li>[ ] Test2</li>
</ul>

So it just returns a simple list, not even some special CSS classes one could use to catch them downstream. Compare that to the example above, i.e. how Github & your browser render it in HTML:

image

So it seems Github internally uses a much different renderer for Markdown than their API uses. That's a little annoying for me too, but I can live with it. It can't be changed unless you'd integrate with some markdown parsing library and I should add that we wouldn't accept a contribution like that in this repo.

PrzemyslawKlys commented 3 years ago

It's not a problem. I'll switch to using emoji which seems to work

image

Thank you for this plugin - it's really amazing and will allow me to combine markdown content of all my projects with my Wordpress abilities! Here's what your plugin did: https://evotec.xyz/hub/scripts/pswritehtml-powershell-module/

nilsnolde commented 3 years ago

Great workaround!:)