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

pass writer options correctly for docusaurus-md #8365

Merged
merged 3 commits into from
Jan 22, 2024
Merged

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Jan 19, 2024

Related to #8332 so that the workaround of setting columns works.

See #8332 for details about the real issue that will be fixed in next Pandoc version

Problem was that setting columns is currently ignored

format: docusaurus-md
columns: 101

This is because we use default PANDOC_WRITER_OPTIONS

local result_str = pandoc.write(result, 'markdown_strict+raw_html+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars+pipe_tables+tex_math_dollars+header_attributes+raw_html+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links')

This PR pass writer options but for now only columns

This is because passing all the PANDOC_WRITER_OPTIONS would have more impact that probably we don't want.
Example setting toc: true has currently no effect. Passing the all options would then create markdown TOC in the output, which I believe is not supported by Docusaurus (and we don't do it in 1.3 either)

So I would have expect this to be what to do (as I think the Writer worked like that) but it seems it is different

diff --git a/src/resources/extensions/quarto/docusaurus/docusaurus_citeproc.lua b/src/resources/extensions/quarto/docusaurus/docusaurus_citeproc.lua
index 15e29fefe4..93645d4877 100644
--- a/src/resources/extensions/quarto/docusaurus/docusaurus_citeproc.lua
+++ b/src/resources/extensions/quarto/docusaurus/docusaurus_citeproc.lua
@@ -10,7 +10,7 @@ function Pandoc(doc)
       end
     end
   })
-
-  local result_str = pandoc.write(result, 'markdown_strict+raw_html+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars+pipe_tables+tex_math_dollars+header_attributes+raw_html+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links')
+  local cli_opts = pandoc.WriterOptions(PANDOC_WRITER_OPTIONS)
+  local result_str = pandoc.write(result, 'markdown_strict+raw_html+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links+autolink_bare_uris+emoji+footnotes+gfm_auto_identifiers+pipe_tables+strikeout+task_lists+tex_math_dollars+pipe_tables+tex_math_dollars+header_attributes+raw_html+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links', cli_opts)
   return pandoc.Pandoc({pandoc.RawBlock('markdown', result_str)})
 end

@cscheid what is your take on this ? Do we need to check more writer options to determine which ones to let pass through ?

As we are so close to 1.4 release, I choose to keep this scoped to #8332

Other note: Setting columns in YAML does not work in 1.3 either. So this is a specific fix for #8332 workaround to work with docusaurus

More would change the current behavior and we don't want that for now. (like `toc: true` would create toc in the output which is for now not handled correcly)
@cscheid cscheid added this to the v1.4 milestone Jan 19, 2024
@cscheid
Copy link
Collaborator

cscheid commented Jan 19, 2024

@cscheid what is your take on this ? Do we need to check more writer options to determine which ones to let pass through ?

Yes, that would be the right thing to do, but it's not clear to me how to decide which to pass and which not to in a principled way.

@cderv
Copy link
Collaborator Author

cderv commented Jan 19, 2024

how to decide which to pass and which not to in a principled way.

I was thinking related to feature that require support or not. Like TOC.

We can probably table that in 1.5 and not now.

@cderv cderv requested a review from cscheid January 22, 2024 10:10
@cscheid cscheid merged commit e820118 into main Jan 22, 2024
47 checks passed
@cscheid cscheid deleted the docusaurus-writer branch January 22, 2024 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants