quarto-dev / quarto-dev/quarto-cli

Customizing Table style in Word Output via Quarto

Open
#10,066 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

docx enhancement pandoc themes
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

I encountered an issue where a table generated with pd.to_markdown in Jupyter Lab loses its borders when exported to Word using Quarto. The borders appear correctly in the PDF output.

How can I resolve the issue of missing table borders in the Word output?
How can I adjust the table style, such as center alignment, when generating Word documents? I am aware of the capabilities of knitr in R Markdown but need a solution entirely in Python.

Thank you for your assistance.

Steps to reproduce

import seaborn as sns
from IPython.display import Markdown, display
mpg = sns.load_dataset("mpg").head(3)
display(Markdown(mpg.to_markdown(index = False)))

Default Left Right Center
12 12 12 12
123 123 123 123
1 1 1 1

: Demonstration of pipe table syntax

bug_demo.zip

Expected behavior

Expected: The table should have borders in both PDF and Word outputs.

Actual behavior

Actual: The table has borders in the PDF output but lacks borders in the Word output.

Your environment

Operating System: Ubuntu 22.04
Jupyter Lab Version:
IPython : 8.18.1
ipykernel : 6.29.4
ipywidgets : 8.1.2
jupyter_client : 8.6.1
jupyter_core : 5.7.2
jupyter_server : 2.14.0
jupyterlab : 4.1.8
nbclient : 0.10.0
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.1.3
qtconsole : 5.5.2
traitlets : 5.14.3

Quarto check output
Quarto 1.5.45
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.45
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2024.06
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/jade/.TinyTeX/bin/x86_64-linux
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.6 (Conda)
      Path: /home/jade/anaconda3/envs/fnirs/bin/python
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.0
      Path: /usr/lib/R
      LibPaths:
        - /home/jade/R/x86_64-pc-linux-gnu-library/4.4
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.46
      rmarkdown: 2.26

[✓] Checking Knitr engine render......OK

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached bug_demo.zip and the Python/Jupyter reproduction using pd.to_markdown, display(Markdown(...)), and Quarto's Word and PDF renders. Compare the generated outputs and investigate the Quarto/Pandoc document-conversion path; done means table borders and requested alignment are preserved in Word as they are in PDF, with a reproducible test or documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, markdown, python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.