quarto-dev / quarto-dev/quarto-cli

Jupyter code block style not preserved when `quarto render`

Open
#10,343 6 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Jul 24, 2024.

bug preview
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

Certain code block styles (eg, code-block-border-left and highlight-style) appear properly in quarto preview but are absent in quarto render when rendering a Jupyter notebook.

Steps to reproduce

In posts/_metadata.yml:

freeze: auto
title-block-banner: true
format:
  html:
    link-external-newwindow: true 
    code-block-bg: true
    code-block-border-left: "#3459e6"
    highlight-style: github
title-prefix: ""

In posts/2024-07-21-code-notebook/index.ipynb:

{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {
    "vscode": {
     "languageId": "raw"
    }
   },
   "source": [
    "---\n",
    "author: \"Firstname Lastname\"\n",
    "title: \"Code Rendering Test\"\n",
    "jupyter: python3\n",
    "date: 2024-07-21\n",
    "---"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def foo(x):\n",
    "    y = 5\n",
    "    return x + y"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

When running quarto preview:

Screenshot 2024-07-21 at 11 03 02 AM

When running quarto render:

Screenshot 2024-07-21 at 11 04 01 AM
Expected behavior

The output from quarto render should implement the code formatting options.

Actual behavior

The code formatting options are not implemented when quarto render.

Your environment
  • macOS Sonoma 14.5
Quarto check output
quarto check
Quarto 1.5.55
[✓] 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.55
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

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

[✓] Checking Python 3 installation....OK
      Version: 3.10.0
      Path: /Users/hodgesmr/.virtualenvs/lambda_calculus/bin/python3
      Jupyter: 4.11.1
      Kernels: python3

(/) Checking Jupyter engine render....Traceback (most recent call last):
  File "/Applications/quarto/share/jupyter/jupyter.py", line 21, in <module>
    from notebook import notebook_execute, RestartKernel
  File "/Applications/quarto/share/jupyter/notebook.py", line 15, in <module>
    from yaml import safe_load as parse_string
ModuleNotFoundError: No module named 'yaml'
[✓] Checking Jupyter 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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.