All Projects → mb21 → pandoc-placetable

mb21 / pandoc-placetable

Licence: GPL-2.0 license
Pandoc filter to include CSV data (from file or URL)

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to pandoc-placetable

citeproc-rs
CSL processor in Rust.
Stars: ✭ 56 (+60%)
Mutual labels:  pandoc, pandoc-filter
dotpandoc
Pandoc Data directory, including customised filters and templates for producing multiple outputs for academic content.
Stars: ✭ 44 (+25.71%)
Mutual labels:  pandoc, pandoc-filter
paru
Control pandoc with Ruby and write pandoc filters in Ruby
Stars: ✭ 30 (-14.29%)
Mutual labels:  pandoc, pandoc-filter
pandoc-amsthm
provide a syntax to use amsthm environments in pandoc, with output in LaTeX and HTML
Stars: ✭ 19 (-45.71%)
Mutual labels:  pandoc, pandoc-filter
Sqlitebiter
A CLI tool to convert CSV / Excel / HTML / JSON / Jupyter Notebook / LDJSON / LTSV / Markdown / SQLite / SSV / TSV / Google-Sheets to a SQLite database file.
Stars: ✭ 601 (+1617.14%)
Mutual labels:  csv, google-sheets
Magento2 Import Export Sample Files
Default Magento 2 CE import / export CSV files & sample files for Firebear Improved Import / Export extension
Stars: ✭ 68 (+94.29%)
Mutual labels:  csv, google-sheets
pandoc-include
Pandoc filter to allow file and header includes
Stars: ✭ 35 (+0%)
Mutual labels:  pandoc, pandoc-filter
fastapi-csv
🏗️ Create APIs from CSV files within seconds, using fastapi
Stars: ✭ 46 (+31.43%)
Mutual labels:  csv, google-sheets
csvtogs
Take a CSV file and create a Google Spreadsheet with the contents
Stars: ✭ 15 (-57.14%)
Mutual labels:  csv, google-sheets
Goloc
A flexible tool for application localization using Google Sheets.
Stars: ✭ 42 (+20%)
Mutual labels:  csv, google-sheets
pandoc-lecture
This project defines a skeleton repo for creating lecture slides and handouts including lecture notes out of Pandoc Markdown (http://pandoc.org/MANUAL.html) using a single source approach.
Stars: ✭ 72 (+105.71%)
Mutual labels:  pandoc, pandoc-filter
LocalizationService
Tools for localization Unity's UIText components
Stars: ✭ 22 (-37.14%)
Mutual labels:  google-sheets
rjsmake
Use Markdown to generate a Reveal.js presentation in minutes.
Stars: ✭ 19 (-45.71%)
Mutual labels:  pandoc
TSDataTable
Simple, Elegant Data Tables for Google Sheets & Sites
Stars: ✭ 23 (-34.29%)
Mutual labels:  google-sheets
dissertation-story
My philosophy dissertation + cloud backup + version control. Written in plaintext Markdown with Sublime Text 3.
Stars: ✭ 14 (-60%)
Mutual labels:  pandoc
tufte-pandoc-jekyll
A Jekyll theme for using Tufte CSS with Jekyll + Pandoc
Stars: ✭ 56 (+60%)
Mutual labels:  pandoc
BakingSheet
Easy datasheet management for C# and Unity. Supports Excel, Google Sheet, JSON and CSV format.
Stars: ✭ 144 (+311.43%)
Mutual labels:  google-sheets
marked-man
Read Markdown files like UNIX man pages
Stars: ✭ 16 (-54.29%)
Mutual labels:  pandoc
my-writing-workflow
Tutorial for converting markdown files in to APA-formatted docs, based on my workflow.
Stars: ✭ 35 (+0%)
Mutual labels:  pandoc
pandoctools
Profile manager of text processing pipelines: Pandoc filters, any text CLI filters. Atom+Markdown+Pandoc+Jupyter workflow, export to ipynb. Uses Stitch fork: https://github.com/kiwi0fruit/knitty
Stars: ✭ 48 (+37.14%)
Mutual labels:  pandoc

pandoc-placetable filter

Note: currently only compatible with pandoc < 2.10, since that release changed the way tables are represented in the document AST substantially.

A Pandoc filter that replaces fenced code blocks (that have the class table) with tables generated from CSV. The CSV is read from the code block and from an optional external CSV file (or URL) and concatenated. There's an option to enable parsing of inline markdown.

Some usage examples:

```{.table file="foo.csv"}
```

```{.table}
some,values
even,"with spaces"
```

```{.table file="https://docs.google.com/spreadsheets/my-publish-to-web-sheet-key&output=csv"}
```

```{.table inlinemarkdown=yes}
"when compiled with the inlineMarkdown flag","we _can_ write **Markdown** here"
```

```{.table file="foo.csv" header=yes}
Fruit,Quantity,Price
```

```{.table file="foo.csv" header=yes aligns=LRCRR inlinemarkdown=yes
     caption="my **caption**" delimiter="," quotechar="\"" }
```

Usage

Prepare a markdown file containing a fenced code block like the ones above, then:

pandoc --filter pandoc-placetable input.md

Alternatively, the program can be used as an ad-hoc csv-reader and run without a markdown file. Then the options can be provided as command-line arguments. For example:

$ pandoc-placetable --file=foo.csv --widths="0.2 0.8" | pandoc -f json -o output.html

Or also:

$ cat foo.csv | pandoc-placetable --widths="0.2 0.8" | pandoc -f json -o output.html

(For this use-case, you might not even need pandoc-placetable; pandoc 2.9.2 and later ships with a simple built-in csv-reader: pandoc foo.csv -o output.html)

All options are optional and are specified as follows (cf. pandoc-placetable -h):

  • csv: The path or URL to the CSV file that is appended to the code block's content
  • file: synonym for csv
  • header: If set to yes, then the first row of data is interpreted as the table headers.
  • aligns: For each column, one letter (L, R or C) that specifies the column's alignment.
  • widths: For each column, a number specifying its width as a fraction of the page width, e.g. widths="0.5 0.2 0.3".
  • inlinemarkdown: If set to yes, interprets the caption and CSV fields as markdown. This requires pandoc-placetable to be compiled with the inlineMarkdown flag (see below).
  • caption: The table caption.
  • delimiter: A one-character string used in the CSV to separate fields, defaults to ,. For characters not allowed standing alone in Pandoc markdown attributes, use \t for a tab and \s for a space.
  • quotechar: A one-character string that may be used in the CSV to quote fields containing special characters, defaults to ".

If there is an id set (e.g. {.table #my-id}), the table will be wrapped in a div with that id so it can be referenced.

Installation

Using cabal and Hackage

cabal update
cabal install pandoc-placetable

Using stack

git clone [email protected]:mb21/pandoc-placetable.git
cd pandoc-placetable
stack install pandoc-placetable

The inlineMarkdown flag

When compiled with the inlineMarkdown flag, the inlinemarkdown=yesoption is available to have CSV and the caption be interpreted as markdown. Note that the flag causes Pandoc to be required as a dependency so it will take a while to build.

cabal install -f inlineMarkdown pandoc-placetable

or:

cd pandoc-placetable
stack install --flag pandoc-placetable:inlineMarkdown pandoc-placetable

Acknowledgments

The idea and syntax for this filter was proposed by @jgm on pandoc-discuss and first implemented by @baig's pandoc-csv2table, over which I consider this filter an improvement.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].