pandoc-ext / list-table Goto Github PK
View Code? Open in Web Editor NEWWrite tables as list of cells and rows.
License: MIT License
Write tables as list of cells and rows.
License: MIT License
I did a bunch of trial and error, but this error message really threw me for a loop. Running
pandoc test.md -o test.pdf --filter ./list-table.lua
I get the error lua: /home/jules/.pandoc/lua_filters/list-table3.lua:8: pandoc version >=2.11 is required
. (Needless to say, I am using a newer version.) The filter works as expected when calling it via:
pandoc test.md -o test.pdf --lua-filter ./list-table.lua
Using this filter for ODT / HTML / LaTeX works, but when I try DOCX output the filter fails:
▶︎ pandoc -s -o list-table.docx -L list-table.lua --verbose list-table.md
[INFO] Running filter /Users/ian/.local/share/pandoc/filters/list-table.lua
[INFO] Completed filter /Users/ian/.local/share/pandoc/filters/list-table.lua in 43 ms
Encountered unassigned table cell
Exception: pandoc exited with 63
▶︎ pandoc -s --pdf-engine=xelatex -o list-table.pdf -L list-table.lua --verbose list-table.md
[INFO] Running filter /Users/ian/.local/share/pandoc/filters/list-table.lua
[INFO] Completed filter /Users/ian/.local/share/pandoc/filters/list-table.lua in 5 ms
[makePDF] temp dir: ... OK
Hi,
I know this is a basic question, but as a novice I can't find an answer. The list-table.lua filter has worked up to now, but then I updated Quarto, and apparently it has gone.
I've downloaded it again, but can't remember how to install it. I tried moving the file in the Applications/quarto/share/filter folder in my Mac Monterey, but it looks like Quarto is not finding it.
Are there installation instructions that I can read?
Paolo
If some cells are undefined, the filter can generate an invalid AST. For example, with this markdown:
::: list-table
* - A
- B
* - 1
:::
...we get the following (edited to show just the offending rows; rep.lua
reports the AST using the logging
module; see below):
% pandoc-3.1.8 -L list-table.lua list-table-bug.md -L rep.lua -t html -o /dev/null
(#) blocks Blocks[1] {
[1] Table {
...
bodies: List[1] {
[1] {
...
body: List[1] {
[1] pandoc.Row {
...
cells: List[1] {
[1] pandoc.Cell {
alignment: "AlignDefault"
attr: Attr {
attributes: AttributeList {}
classes: List {}
identifier: ""
}
col_span: 1
contents: Blocks[1] {
[1] Plain {
content: Inlines[1] {
[1] Str "1"
}
}
}
row_span: 1
}
}
}
}
...
The row only contains a single cell, so this is an invalid AST and isn't handled correctly by all writers (see jgm/pandoc#9096 for further discussion).
The filter should be updated to add empty cells for any missing ones.
Here's rep.lua
local logging = require 'logging'
function Pandoc(pandoc)
if logging.loglevel > 0 then
logging.temp('meta', pandoc.meta)
end
logging.temp('blocks', pandoc.blocks)
end
Hello!
markdown_github
because of supported features.Here is a small YAML default file code:
filters:
- assets/filters/lua/list-table.lua
template: "assets/templates/confluence"
variables:
confluence_html: true
languages:
- english
- español
- français
- português
And VSCode's Codebraid settings:
{
"codebraid.preview.css.overrideDefault": true,
"codebraid.preview.css.useDefault": true,
"codebraid.preview.css.useMarkdownPreviewFontSettings": true,
"codebraid.preview.pandoc.defaultsFile": "confluence.yaml",
"codebraid.preview.pandoc.executable": "pandoc",
"codebraid.preview.pandoc.showRaw": true,
"codebraid.preview.pandoc.showStderr": "never",
"codebraid.preview.security.allowEmbeddedScripts": true,
"codebraid.preview.security.allowInlineScripts": true,
"codebraid.preview.security.allowLocalScripts": true,
"codebraid.preview.security.allowRemoteFonts": true,
"codebraid.preview.security.allowRemoteImages": true,
"codebraid.preview.security.allowRemoteMedia": true,
"codebraid.preview.security.allowRemoteScripts": true,
"codebraid.preview.security.allowRemoteStyles": true,
"codebraid.preview.scrollEditorWithPreview": true,
"codebraid.preview.scrollPreviewWithEditor": true,
"codebraid.preview.pandoc.build":
{
"*.md":
{
"reader": "markdown_github",
"preview":
{
"html":
{
"defaults": {},
"options":
[
"--preserve-tabs",
"--standalone",
"--wrap=auto",
]
}
},
"export": {}
},
},
}
Here is a small Pandoc template code:
$if(confluence_html)$
<html $if(lang)$lang="$lang$" $endif$>
<head>
<meta charset="UTF-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
</head>
<body>
$endif$
<div class="ids-markdown">
Testing...
$body$
</div>
$if(confluence_html)$
</body>
</html>
$endif$
I tested the simple list-table
code in a Markdown file:
# Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit, minus?
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Vero, adipisci sequi? Maiores autem quaerat praesentium?
:::list-table
* - row 1, column 1
- row 1, column 2
- row 1, column 3
* - row 2, column 1
-
- row 2, column 3
* - row 3, column 1
- row 3, column 2
:::
I tested with the markdown_github
format and here is the result. It failed to render the code:
I switched to the format commonmark_x
and tested it. Here is the error:
See #4 for context, especially this comment.
List tables are dependent on fenced divs. As shown in the screenshot (taken from the pandoc manual) fenced divs are only enabled by default for commonmark_x
, markdown
and opml
. Other markdown variants will have to enable them explicitly. The documentation should make this clear.
See #4 for context, especially this comment.
In order for the filter to work with the codebraid VS Code preview, it needs to address this note and handle elements with data-pos
attributes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.