Skip to content
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

feature request: allow customized pandoc args #886

Open
ickc opened this issue Dec 3, 2021 · 3 comments
Open

feature request: allow customized pandoc args #886

ickc opened this issue Dec 3, 2021 · 3 comments
Labels
question Further information is requested

Comments

@ickc
Copy link

ickc commented Dec 3, 2021

Currently, in

"--from markdown --to ipynb -s --atx-headers --wrap=preserve --preserve-tabs",
,
"--from ipynb --to markdown -s --atx-headers --wrap=preserve --preserve-tabs",
,
pandoc args are hardcoded.

The feature request is to propose allowing customization.

E.g. see

pandoc --list-extensions=markdown
pandoc --list-extensions=ipynb

for customization for extensions alone (where one can fine-tune their own markdown variants so to speak.)

@mwouts
Copy link
Owner

mwouts commented Dec 4, 2021

Hello @ickc , sure we could do that. How would you like to use this customization?

Maybe we could create a new format option (would pandoc_extra_args be a good name?) for the md:pandoc format, and allow the user to specify a custom value either through jupytext --opt pandoc_extra_args='...', or through pandoc_extra_args in the juptyext.toml file?

Also, what should be the logic for building the conversion command? Do you think anyone would like to use other header styles than --atx-headers? I.e. do you prefer

 f"--from markdown --to ipynb {pandoc_custom_args or '-s --atx-headers --wrap=preserve --preserve-tabs'}"

or

 f"--from markdown --to ipynb -s --atx-headers --wrap=preserve --preserve-tabs {pandoc_extra_args}"

@mwouts mwouts added the question Further information is requested label Dec 9, 2021
@mfhepp
Copy link

mfhepp commented Sep 25, 2022

Not sure this is the right issue, but this could maybe help support using bibliographic references in notebooks, at least from the Markdown document to the .ipynb document - so that e.g. @foo2022b could be translated into the proper reference by using citeproc.

Also custom filters could be plugged in here.

NB: A quick way of implementing that would be supporting a Pandoc defaults YAML file if it exists - so if e.g. pandoc_jupytext.yaml exists, then the settings from there would be passed to Pandoc. That would be a very flexible and lightweight way of modifying the invocation parameters. Or support a pandoc_defaults property in jupytext.toml. So all the parsing would be delegated to Pandoc.

@mwouts
Copy link
Owner

mwouts commented Oct 6, 2022

Hi @mfhepp , I like your suggestion of adding a new pandoc_defaults (or maybe pandoc_args) option. Unfortunately at the moment I am not available to do so, but maybe you could consider contributing a PR for that? Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants