`include-before-body` and `include-after-body` have no effect for docx output
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 58/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- javascript, lua
- Domaine
- backend
Piste de recherche
Start with src/resources/filters/quarto-init/includes.lua and src/resources/filters/common/meta.lua, which the issue links to, and trace how include content becomes a raw block for docx. Check the existing tests for docx includes, then reproduce with the provided before.xml and after.xml example. Done means both markers appear in word/document.xml for include-before-body and include-after-body.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
Since Pandoc 3.2.1, --include-before-body and --include-after-body work with docx: the files are OpenXML fragments inserted in the document body. With Quarto, their content never reaches word/document.xml. The same happens with text in include-before and include-after.
Quarto reads include files in a Lua filter and adds their content to the metadata as a raw block, with FORMAT as the raw format:
For docx, FORMAT is docx, so the raw block is RawBlock("docx", ...). Pandoc's docx writer only keeps raw openxml and drops the rest. A markdown document with both a ```{=docx} and a ```{=openxml} block shows it: only the openxml one is in the output.
Steps to reproduce
before.xml:
<w:p><w:r><w:t>MARKER-BEFORE</w:t></w:r></w:p>
after.xml:
<w:p><w:r><w:t>MARKER-AFTER</w:t></w:r></w:p>
doc.qmd:
---
title: Hello
format:
docx:
include-before-body: before.xml
include-after-body: after.xml
---
Body text.
quarto render doc.qmd
unzip -p doc.docx word/document.xml | grep -o 'MARKER-[A-Z]*'
Actual behavior
No output: neither paragraph is in word/document.xml. Same with include-before: '<w:p>...</w:p>' and include-after: in YAML.
Expected behavior
Both paragraphs are in the document, like with Pandoc directly:
quarto pandoc -f markdown -t docx --include-before-body before.xml --include-after-body after.xml -o p.docx doc.qmd
unzip -p p.docx word/document.xml | grep -o 'MARKER-[A-Z]*'
# MARKER-BEFORE
# MARKER-AFTER
A post-render Lua filter that changes the format of these raw blocks in include-before to openxml makes the paragraph appear, and the result opens in Word. We could use openxml as the raw format for docx when adding includes.
Your environment
- OS: Windows 11
- Same result with Quarto 1.11.9, 1.12.3, and
mainat cda4102 (Pandoc 3.13). Not a regression as far as I can tell.
Related: #15399
- Langage dominant
- JavaScript
- Étoiles
- 6.2k
- Forks
- 492
- Merge moyen
- 15 h 15 min
- PR mergées (30 j)
- 94
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de quarto-dev/quarto-cli
-
bootstrap enhancement themes
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
quarto-dev/quarto-cli#15421 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
quarto-dev/quarto-cli#15408 ·
Les mainteneurs répondent en général sous 1 jour
-
accessibility bug
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
quarto-dev/quarto-cli#15401 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
bug callouts docx regression
Difficulté 2/5 1-3 heures Accessibilité débutants 81/100
quarto-dev/quarto-cli#15394 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug lightbox
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
quarto-dev/quarto-cli#15393 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de quarto-dev/quarto-cli
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
testing-library/jest-dom#749 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
ernst:4-klein prio:3-wacht ui
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
NewspeedyNL/PidLane#767 ·
Les mainteneurs répondent en général sous 1 jour
-
bug for-agent ready
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
WenyuChiou/agent-board#1812 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
bug help wanted Should Have ui
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
hannahro15/Musical-Match-Saga#327 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour