pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

Graph and chart from markdown table #148

Closed cannyboy closed 1 year ago

cannyboy commented 3 years ago

(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.

alerque commented 3 years ago

then have that chart produced when converted by markdown

Produced by what? Converted into what?

tarleb commented 3 years ago

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.

cannyboy commented 3 years ago

Produced by what? Converted into what?

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

cannyboy commented 3 years ago

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/

ickc commented 3 years ago

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.

tarleb commented 1 year ago

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