{"id":13425712,"url":"https://github.com/mb21/pandoc-placetable","last_synced_at":"2025-03-17T06:31:29.238Z","repository":{"id":56874470,"uuid":"38968160","full_name":"mb21/pandoc-placetable","owner":"mb21","description":"Pandoc filter to include CSV data (from file or URL)","archived":false,"fork":false,"pushed_at":"2020-08-05T13:58:49.000Z","size":41,"stargazers_count":39,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T19:02:06.738Z","etag":null,"topics":["csv","google-sheets","pandoc","pandoc-filter"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mb21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-12T16:09:13.000Z","updated_at":"2024-10-06T05:11:21.000Z","dependencies_parsed_at":"2022-08-20T10:11:09.500Z","dependency_job_id":null,"html_url":"https://github.com/mb21/pandoc-placetable","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpandoc-placetable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpandoc-placetable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpandoc-placetable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mb21%2Fpandoc-placetable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mb21","download_url":"https://codeload.github.com/mb21/pandoc-placetable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847062,"owners_count":20357317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","google-sheets","pandoc","pandoc-filter"],"created_at":"2024-07-31T00:01:17.179Z","updated_at":"2025-03-17T06:31:28.921Z","avatar_url":"https://github.com/mb21.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"# pandoc-placetable filter\n\n**Note: currently only compatible with pandoc \u003c 2.10**,\nsince that release changed the way tables are represented in the document AST substantially.\n\nA Pandoc filter that replaces [fenced code blocks](http://pandoc.org/README.html#fenced-code-blocks)\n(that have the class `table`) with tables generated from CSV. The CSV is read from the code block\nand from an optional external CSV file (or URL) and concatenated. There's an option to enable\nparsing of inline markdown.\n\nSome usage examples:\n\n    ```{.table file=\"foo.csv\"}\n    ```\n\n    ```{.table}\n    some,values\n    even,\"with spaces\"\n    ```\n\n    ```{.table file=\"https://docs.google.com/spreadsheets/my-publish-to-web-sheet-key\u0026output=csv\"}\n    ```\n\n    ```{.table inlinemarkdown=yes}\n    \"when compiled with the inlineMarkdown flag\",\"we _can_ write **Markdown** here\"\n    ```\n\n    ```{.table file=\"foo.csv\" header=yes}\n    Fruit,Quantity,Price\n    ```\n\n    ```{.table file=\"foo.csv\" header=yes aligns=LRCRR inlinemarkdown=yes\n         caption=\"my **caption**\" delimiter=\",\" quotechar=\"\\\"\" }\n    ```\n\n\n## Usage\n\nPrepare a markdown file containing a fenced code block like the ones above, then:\n\n    pandoc --filter pandoc-placetable input.md\n\n\nAlternatively, the program can be used as an ad-hoc csv-reader and run without a markdown file.\nThen the options can be provided as command-line arguments. For example:\n\n    $ pandoc-placetable --file=foo.csv --widths=\"0.2 0.8\" | pandoc -f json -o output.html\n\nOr also:\n\n    $ cat foo.csv | pandoc-placetable --widths=\"0.2 0.8\" | pandoc -f json -o output.html\n\n(For this use-case, you might not even need pandoc-placetable; pandoc 2.9.2 and later ships\nwith a simple built-in csv-reader: `pandoc foo.csv -o output.html`)\n\nAll options are optional and are specified as follows (cf. `pandoc-placetable -h`):\n\n- **csv**: The path or URL to the CSV file that is appended to the code block's content\n- **file**: synonym for `csv`\n- **header**: If set to `yes`, then the first row of data is interpreted as the table headers.\n- **aligns**: For each column, one letter (L, R or C) that specifies the column's alignment.\n- **widths**: For each column, a number specifying its width as a fraction of the page width,\n  e.g. `widths=\"0.5 0.2 0.3\"`.\n- **inlinemarkdown**: If set to yes, interprets the caption and CSV fields as markdown.\n  This requires pandoc-placetable to be compiled with the `inlineMarkdown` flag (see below).\n- **caption**: The table caption.\n- **delimiter**: A one-character string used in the CSV to separate fields, defaults to `,`.\n  For characters not allowed standing alone in Pandoc markdown attributes, use `\\t` for a\n  tab and `\\s` for a space.\n- **quotechar**: A one-character string that may be used in the CSV to quote fields containing\n  special characters, defaults to `\"`.\n\nIf there is an `id` set (e.g. `{.table #my-id}`), the table will be wrapped in a `div` with\nthat `id` so it can be referenced.\n\n## Installation\n\n### Using cabal and Hackage\n\n    cabal update\n    cabal install pandoc-placetable\n\n### Using stack\n\n    git clone git@github.com:mb21/pandoc-placetable.git\n    cd pandoc-placetable\n    stack install pandoc-placetable\n\n### The inlineMarkdown flag\n\nWhen compiled with the `inlineMarkdown` flag, the `inlinemarkdown=yes`option is available to\nhave CSV and the caption be interpreted as markdown. Note that the flag causes Pandoc to be\nrequired as a dependency so it will take a while to build.\n\n    cabal install -f inlineMarkdown pandoc-placetable\n\nor:\n\n    cd pandoc-placetable\n    stack install --flag pandoc-placetable:inlineMarkdown pandoc-placetable\n\n\n## Acknowledgments\n\nThe idea and syntax for this filter was proposed by @jgm on\n[pandoc-discuss](https://groups.google.com/forum/#!topic/pandoc-discuss/kBdJU_JktzI)\nand first implemented by @baig's [pandoc-csv2table](https://github.com/baig/pandoc-csv2table),\nover which I consider this filter an [improvement](https://github.com/mb21/pandoc-placetable/issues/1).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmb21%2Fpandoc-placetable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmb21%2Fpandoc-placetable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmb21%2Fpandoc-placetable/lists"}