-
Hello. I have a custom writer that, given this input:
is generating this output:
But I don't want the blank line before the nested list (this is targeted at Typst, and the blank line makes a difference). I looked into this and it seems that the explanation is that that the default I modified the writer to use this instead (
and I now get this output:
Compare with the default Typst writer, which gives:
I'd prefer that, but Typst doesn't require the blank line, so my version seems to work. Finally to my question. What should I really be doing here? Ideally I'd only use standard features of the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
@tarleb, can you shed any light on this? Thanks. |
Beta Was this translation helpful? Give feedback.
-
That's correct.
That depends, of course. What the built-in Typst writer is doing is to append blank lines to most elements like BulletList, Para, etc, but not to others, e.g. Plain. The final result is then generated by stacking all rendered blocks on top of each other, but without adding an empty line in-between. Something like this: local layout = require 'pandoc.layout'
Writer.Block.Para = function (para)
return {Writer.Inlines(para.content), layout.blankline}
end
Writer.Block.Plain = function (plain)
return Writer.Inlines(plain.content)
end
Writer.Pandoc = function (doc)
-- The second argument to `Writer.Blocks` is the separator.
-- It the separator is optional and defaults to `layout.blankline`.
return Writer.Blocks(doc.blocks, layout.cr)
end |
Beta Was this translation helpful? Give feedback.
-
Thanks! I didn't realise about the |
Beta Was this translation helpful? Give feedback.
That's correct.
That depends, of course. What the built-in Typst writer is doing is to append blank lines to most elements like BulletList, Para, etc, but not to others, e.g. Plain. The final result is then generated by stacking all rendered blocks on top of each other, but without adding an empty line in-between.
Something like this: