You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Quarto HTML输出中替换图题冒号为句号的技术问询

Solution to Replace Figure Caption Colon with Period in Quarto HTML

Method 1: Use Quarto's Built-in Metadata Setting

  • Add the caption-label-separator option to your document's YAML metadata to globally adjust the separator for all figures, tables, and other captioned elements:
---
title: "Your Document Title"
format: html
caption-label-separator: "."
---
  • This directly modifies how Quarto generates caption labels, replacing the default colon with a period.

Method 2: Lua Filter for Targeted Control

If the metadata setting doesn't work (e.g., for older Quarto versions), create a Lua filter file (e.g., caption-sep.lua) with the following code to rewrite caption text:

function Figure(el)
  if el.caption and el.caption[1] then
    el.caption[1].text = el.caption[1].text:gsub("(Figure %d+):", "%1.")
  end
  return el
end

function Table(el)
  if el.caption and el.caption[1] then
    el.caption[1].text = el.caption[1].text:gsub("(Table %d+):", "%1.")
  end
  return el
end
  • Reference the filter in your document's YAML to apply the change:
---
title: "Your Document Title"
format: html
filters:
  - caption-sep.lua
---

Why CSS Didn't Work

The default "Figure X:" is part of the raw caption text generated by Quarto, not a stylistic addition via CSS. Custom CSS can only modify visual styles, not the actual text content, so it can't replace the colon with a period.

内容的提问来源于stack exchange,提问作者Eric Krantz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 03:44:53