-
-
Notifications
You must be signed in to change notification settings - Fork 978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for number_offset metadata with number-sections.lua #1999
base: main
Are you sure you want to change the base?
Conversation
Maybe we should consider consistent behaviors on formats with native
|
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this PR, and will let @cderv decide whether to merge it. Thanks!
Unfortunately, there is no way to tell Lua filter the value of
--number-offset
.
Yes, that's unfortunate. It will be great if we don't have to introduce a new field in YAML.
I took time on this one because I needed to think about it. I really don't like adding a new YAML field, all the more not under a format function but at the first level in the YAML. This usually is to pass variable to pandoc. It is already not quite easy to follow which field will be processed by which tool so I am not sure about this. But even considering that, I thought deeper about the why we would need this.
This means that Maybe this option to offset the numbering is only useful when producing HTML documents ? Is there a use case behind this PR @atusy or just a quest of completeness ? If we were to do it, I would prefer having the field be at the same level of ---
output:
md_document:
number_sections: true
number_offset: 3
--- I may be wrong but I assume that field under output are mainly processed by R, whereas other field are mainly for Pandoc to use directly. I would also add this in What are your thoughts on all this ? |
Thanks @cderv for your insightful comments. I understand completeness is not always the priority and am fine to close this PR. I am currently co-authoring a book with R Markdown, and each authors render .md files per their chapters. |
Oh that is interesting. So you are running pandoc on each file ? and not on all separate file at once ? How does it work with PDF ? Do you use the Lua filter instead of the |
Yes, we run pandoc on each file. Actually, conversion to PDF is not author's scope. |
ok. Thanks for sharing! |
FYI Pandoc 2.17 has now added a Global Variable
Maybe this would prevent us for adding a new first level YAML field for the Lua Filter to work. Which is mainly why I am holding merging this PR for now, waiting for a better solution. That may be it. |
Thank you for good news! I think it is okay to support |
Cool ! Let me know if this enough - I never used this variable before. Hopefully it will work well for this ! And open room for other feature in Lua! |
number-sections.lua
enables numbering sections for formats without it.However, current implementation lacks the support for
--number-offset
.Unfortunately, there is no way to tell Lua filter the value of
--number-offset
.Thus, this PR reads
number-offset
metadata as an alternative.Reprex: