Skip to content

Lua: "text"/"binary" instead of true as values in pandoc.readers and pandoc.writers #11367

@bpj

Description

@bpj

Describe your proposed improvement and the problem it solves.

Currently the values in the tables pandoc.readers and pandoc.writers are booleans true. I think it would be useful to make them strings "text" or "binary" depending on which kind of format it is, so that you can check not only if a format name supplied by the user is valid but also whether the format is appropriate for reading/writing from/to a string.

My use case is a filter which walks a table read from CSV/TSV and uses pandoc.read to parse the cell contents (which always are literal strings when read from those formats) as markdown or other markup. The desired markup format (and any extensions) can be specified in metadata.

I get these (TSV) files when I use a spreadsheet or an editor CSV/TSV plugin to author the source for tables, which is useful for inserting/deleting/moving columns for example. I may be the only one with this particular use case, but I believe there may be other situations where this feature would be useful.

Describe alternatives you've considered.

  • Inlining my own table in the filter :-(
  • Letting Pandoc die with an unhelpful error message, or at least capture the error and trying to give a helpful message, which has proven hard.
  • A table pandoc.binary_formats may be a better idea than changing the existing tables.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions