markdown-to-json
markdown-to-json copied to clipboard
not supporting table
What are you using a markdown parser?
It seems to be strict markdown without github or gitlab flavor support, table are no supported:
$ md_to_json index.md
Traceback (most recent call last):
File "/home/noraj/.local/share/virtualenvs/table-iZ6bjDlQ/bin/md_to_json", line 10, in <module>
sys.exit(main())
File "/home/noraj/.local/share/virtualenvs/table-iZ6bjDlQ/lib/python3.7/site-packages/markdown_to_json/scripts/md_to_json.py", line 89, in main
indent)
File "/home/noraj/.local/share/virtualenvs/table-iZ6bjDlQ/lib/python3.7/site-packages/markdown_to_json/scripts/md_to_json.py", line 68, in jsonify_markdown
rendered = renderer.stringify_dict(nested)
File "/home/noraj/.local/share/virtualenvs/table-iZ6bjDlQ/lib/python3.7/site-packages/markdown_to_json/markdown_to_json.py", line 114, in stringify_dict
for k, v in d.items()
AttributeError: 'list' object has no attribute 'items'
My source is something like that:
Contest | Date | Location | Links
--- | --- | --- | ---
SigSeg V1 | Sat, 01 Dec. 2018 Sun, 02 Dec. 2018 | Paris, IdF, France | [website][sigsegv1]
Hack.lu CTF 2018 | Tue, 16 Oct. 2018 Thu, 18 Oct. 2018 | On-line | [CTFTime][ctftimeHacklu2018] - [website][hacklu]
picoCTF 2018 | Fri, 28 Sep. 2018 Fri, 12 Oct. 2018 | On-line | [CTFTime][ctftimePicoCTF2018] - [website][picoCTF]
[sigsegv1]:https://sigsegv1.rtfm.re/
[ctftimeHacklu2018]:https://ctftime.org/event/699
[hacklu]:https://arcade.fluxfingers.net/
[ctftimePicoCTF2018]:https://ctftime.org/event/681
[picoCTF]:https://picoctf.com/
I'm using commonmark, which indeed does not support tables.
What sort of json output would you expect? I guess... maybe nested arrays?
Something like this I guess,
{[
{"Contest":"A", "Date":"B", "Location":"C"},
{"Contest":"D", "Date":"E", "Location":"F"},
{"Contest":"G", "Date":"H", "Location":"I"}
]}
That makes sense. But until the commonmark python library supports table syntax we're not gonna be able to do it.
Actually: This might be a path forward: https://github.com/GovReady/CommonMark-py-Extensions
Yeah if you want to be strict about Markdown syntax using commonmark, the path is to enable it via extensions.