lua-filters icon indicating copy to clipboard operation
lua-filters copied to clipboard

Graph and chart from markdown table

Open cannyboy opened this issue 4 years ago • 5 comments
trafficstars

(Don't know if this is the right place to talk about this...)

Theres's a few filters which allow you to make charts and graphs ... mermaid, graphviz etc, but they all seem excessively complicated. And also, they're missing a trick. We can already show a table in markdown like so:

| Product    | Amount   |
|------------|----------|
| Apple      | 15       |
| Pear       | 10       |
| Orange     | 5        | 

So would it not be desirable to be able to surround it with back-ticks and a chart-type label, and then have that chart produced when converted by markdown?

```pie

| Product    | Amount   |
|------------|----------|
| Apple      | 15       |
| Pear       | 10       |
| Orange     | 5        | 

`` ` 

pie could be line, bar etc. If it can't be parsed it can default to a table.

cannyboy avatar Nov 30 '20 19:11 cannyboy

then have that chart produced when converted by markdown

Produced by what? Converted into what?

alerque avatar Nov 30 '20 19:11 alerque

Indeed, that would be quite nice. Do you know about R Markdown? Maybe not exactly what you are asking for, but a great tool which uses pandoc behind the scenes. Works with multiple programming languages, despite the name.

tarleb avatar Nov 30 '20 19:11 tarleb

Produced by what? Converted into what?

Produced by pandoc (with a filter) from markdown into PDF (and maybe html)

cannyboy avatar Nov 30 '20 21:11 cannyboy

I don’t know what UK gov’s tech stack is, but they describe something similar here: https://insidegovuk.blog.gov.uk/2013/08/21/barcharts-in-html-publications-new-feature/

cannyboy avatar Nov 30 '20 21:11 cannyboy

I've been working on a Python library handling tables and what you described is part of the road map. But functionality like this probably won't be implemented soon until pandoc-types on tables are finalized.

ickc avatar Nov 30 '20 23:11 ickc

Closing this here, as filter maintenance now happens in the pandoc-ext organization.

tarleb avatar Apr 17 '23 09:04 tarleb