Skip to content

Support non-ASCII characters in crossreferenceable labels #9405

@nighthink

Description

@nighthink

Bug description

I used the jupyter engine and python code to draw two different bar charts using the matplotlib drawing library. In jupyter they would output correctly, but with quarto preview, he outputs two identical images. The reason is that #| label: fig-qxz contains Chinese characters.

Steps to reproduce

---
title: aaa
author: aaa
format:
  typst:
    number-sections: true

execute:
  echo: false
  warning: false
fig-align: center
editor:
  render-on-save: true
engine: jupyter
---

```{python}
import numpy
import matplotlib.pyplot as plt
from matplotlib import rcParams
import pandas as pd
%config InlineBackend.figure_format = 'svg'
```

```{python}
#| label: fig-你好
#| fig-cap: aaa


df = pd.DataFrame({'Categories': ['A', 'B', 'C'], 'Values': [10, 20, 30]})

fig1, ax1 = plt.subplots(figsize=(8, 2.5))
ax1.bar(df["Categories"], df["Values"])
plt.show()
```

```{python}
#| label: fig-世界
#| fig-cap: bbb

df2 = pd.DataFrame({'Categories': ['D', 'E', 'F'], 'Values': [30,20,10]})

fig2, ax2 = plt.subplots(figsize=(8, 2.5))
ax2.bar(df2["Categories"], df2["Values"])
plt.show()
```

Expected behavior

屏幕截图 2024-04-18 204029

Actual behavior

error

Your environment

  • IDE: VS Code
  • Windows 11

Quarto check output

Quarto 1.5.30

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions