图书选项
以下文档列出了book
项目所有可用的选项。有关使用Quarto创建书籍的深入指南,请参阅创建书籍。
项目
定义项目类型、渲染目标和输出的选项。项目选项在 project
键下指定。例如:
_quarto.yml
project:
type: 书籍
output-dir: _书籍
title |
|
type |
Project type ( |
render |
Files to render (defaults to all files) |
execute-dir |
Control the working directory for computations.
|
output-dir |
Output directory |
lib-dir |
HTML library (JS/CSS/etc.) directory |
resources |
Additional file resources to be copied to output directory |
preview |
Options for |
pre-render |
Scripts to run as a pre-render step |
post-render |
Scripts to run as a post-render step |
预览
在 preview
键下指定控制 quarto preview
行为的选项。例如:
_quarto.yml
project:
type: 书籍
output-dir: _书籍
preview:
port: 4200
browser: false
可用的 preview
选项包括:
port |
Port to listen on (defaults to random value between 3000 and 8000) |
host |
Hostname to bind to (defaults to 127.0.0.1) |
serve |
Options for external preview server (see Serve) |
browser |
Open a web browser to view the preview (defaults to true) |
watch-inputs |
Re-render input files when they change (defaults to true) |
navigate |
Navigate the browser automatically when outputs are updated (defaults to true) |
timeout |
Time (in seconds) after which to exit if there are no active clients |
服务
如果你正在为包含自己的预览服务器的另一个发布系统创建项目扩展(例如,Hugo 或 Docusaurus),那么使用 preview: serve
选项来自定义预览服务器的行为。
_quarto.yml
project:
type: 书籍
preview:
serve:
cmd: "hugo serve --port {port} --bind {host} --navigateToChanged"
env:
HUGO_RELATIVEURLS: "true"
ready: "Web Server is available at"
cmd |
Serve project preview using the specified command. Interpolate the |
args |
Additional command line arguments for preview command. |
env |
Environment variables to set for preview command. |
ready |
Regular expression for detecting when the server is ready. |
参见 Hugo 和 Docusaurus 扩展源代码,了解 preview: serve
的示例用法。
书籍
影响书籍输出的选项。书籍选项在书籍
键下指定。例如:
_quarto.yml
书籍:
title: "我的书籍"
image: opengraph.png
page-navigation: true
title |
Book title |
subtitle |
Book subtitle |
author |
Author or authors of the book |
date |
Book publication date |
date-format |
Format string for dates in the book |
abstract |
Book abstract |
description |
Description metadata for HTML version of book |
references |
Book references file |
output-file |
Base name for single-file output (e.g. PDF, ePub) |
cover-image |
Cover image (used in HTML and ePub formats) |
cover-image-alt |
Alternative text for cover image (used in HTML format) |
sharing |
Sharing buttons to include on navbar or sidebar (one or more of |
downloads |
Download buttons for other formats to include on navbar or sidebar (one or more of |
tools |
Custom tools for navbar or sidebar |
doi |
The Digital Object Identifier for this book. |
abstract-url |
A url to the abstract for this item. |
accessed |
Date the item has been accessed. |
annote |
Short markup, decoration, or annotation to the item (e.g., to indicate items included in a review); For descriptive text (e.g., in an annotated bibliography), use |
archive |
Archive storing the item |
archive-collection |
Collection the item is part of within an archive. |
archive-location |
Storage location within an archive (e.g. a box and folder number). |
archive-place |
Geographic location of the archive. |
authority |
Issuing or judicial authority (e.g. “USPTO” for a patent, “Fairfax Circuit Court” for a legal case). |
available-date |
Date the item was initially available (e.g. the online publication date of a journal article before its formal publication date; the date a treaty was made available for signing). |
call-number |
Call number (to locate the item in a library). |
chair |
The person leading the session containing a presentation (e.g. the organizer of the |
chapter-number |
Chapter number (e.g. chapter number in a book; track number on an album). |
citation-key |
Identifier of the item in the input data file (analogous to BiTeX entrykey); Use this variable to facilitate conversion between word-processor and plain-text writing systems; For an identifer intended as formatted output label for a citation (e.g. “Ferr78”), use |
citation-label |
Label identifying the item in in-text citations of label styles (e.g. “Ferr78”); May be assigned by the CSL processor based on item metadata; For the identifier of the item in the input data file, use |
collection-editor |
Editor of the collection holding the item (e.g. the series editor for a book). |
collection-number |
Number identifying the collection holding the item (e.g. the series number for a book) |
collection-title |
Title of the collection holding the item (e.g. the series title for a book; the lecture series title for a presentation). |
compiler |
Person compiling or selecting material for an item from the works of various persons or bodies (e.g. for an anthology). |
composer |
Composer (e.g. of a musical score). |
container-author |
Author of the container holding the item (e.g. the book author for a book chapter). |
container-title |
Title of the container holding the item (e.g. the book title for a book chapter, the journal title for a journal article; the album title for a recording; the session title for multi-part presentation at a conference) |
contributor |
A minor contributor to the item; typically cited using “with” before the name when listed in a bibliography. |
curator |
Curator of an exhibit or collection (e.g. in a museum). |
dimensions |
Physical (e.g. size) or temporal (e.g. running time) dimensions of the item. |
director |
Director (e.g. of a film). |
division |
Minor subdivision of a court with a |
edition |
(Container) edition holding the item (e.g. “3” when citing a chapter in the third edition of a book). |
editor |
The editor of the item. |
editorial-director |
Managing editor (“Directeur de la Publication” in French). |
editor-translator |
Combined editor and translator of a work. The citation processory must be automatically generate if editor and translator variables are identical; May also be provided directly in item data. |
event-date |
Date the event related to an item took place. |
event-title |
Name of the event related to the item (e.g. the conference name when citing a conference paper; the meeting where presentation was made). |
event-place |
Geographic location of the event related to the item (e.g. “Amsterdam, The Netherlands”). |
executive-producer |
Executive producer of the item (e.g. of a television series). |
fulltext-url |
A url to the full text for this item. |
genre |
Type, class, or subtype of the item (e.g. “Doctoral dissertation” for a PhD thesis; “NIH Publication” for an NIH technical report); Do not use for topical descriptions or categories (e.g. “adventure” for an adventure movie) |
guest |
Guest (e.g. on a TV show or podcast). |
host |
Host of the item (e.g. of a TV show or podcast). |
id |
A value which uniquely identifies this item. |
illustrator |
Illustrator (e.g. of a children’s book or graphic novel). |
interviewer |
Interviewer (e.g. of an interview). |
isbn |
International Standard Book Number (e.g. “978-3-8474-1017-1”). |
issn |
International Standard Serial Number. |
issue |
Issue number of the item or container holding the item (e.g. “5” when citing a journal article from journal volume 2, issue 5); Use |
issued |
Date the item was issued/published. |
jurisdiction |
Geographic scope of relevance (e.g. “US” for a US patent; the court hearing a legal case). |
keyword |
Keyword(s) or tag(s) attached to the item. |
language |
The language of the item (used only for citation of the item). Should be entered as an ISO 639-1 two-letter language code (e.g. “en”, “zh”), optionally with a two-letter locale code (e.g. “de-DE”, “de-AT”). This does not change the language of the item, instead it documents what language the item uses (which may be used in citing the item). |
license |
The license information applicable to an item (e.g. the license an article or software is released under; the copyright information for an item; the classification status of a document) |
locator |
A cite-specific pinpointer within the item (e.g. a page number within a book, or a volume in a multi-volume work). Must be accompanied in the input data by a label indicating the locator type (see the Locators term list). |
medium |
Description of the item’s format or medium (e.g. “CD”, “DVD”, “Album”, etc.) |
narrator |
Narrator (e.g. of an audio book). |
note |
Descriptive text or notes about an item (e.g. in an annotated bibliography). |
number |
Number identifying the item (e.g. a report number). |
number-of-pages |
Total number of pages of the cited item. |
number-of-volumes |
Total number of volumes, used when citing multi-volume books and such. |
organizer |
Organizer of an event (e.g. organizer of a workshop or conference). |
original-author |
The original creator of a work (e.g. the form of the author name listed on the original version of a book; the historical author of a work; the original songwriter or performer for a musical piece; the original developer or programmer for a piece of software; the original author of an adapted work such as a book adapted into a screenplay) |
original-date |
Issue date of the original version. |
original-publisher |
Original publisher, for items that have been republished by a different publisher. |
original-publisher-place |
Geographic location of the original publisher (e.g. “London, UK”). |
original-title |
Title of the original version (e.g. “Война и мир”, the untranslated Russian title of “War and Peace”). |
page |
Range of pages the item (e.g. a journal article) covers in a container (e.g. a journal issue). |
page-first |
First page of the range of pages the item (e.g. a journal article) covers in a container (e.g. a journal issue). |
page-last |
Last page of the range of pages the item (e.g. a journal article) covers in a container (e.g. a journal issue). |
part-number |
Number of the specific part of the item being cited (e.g. part 2 of a journal article). Use |
part-title |
Title of the specific part of an item being cited. |
pdf-url |
A url to the pdf for this item. |
performer |
Performer of an item (e.g. an actor appearing in a film; a muscian performing a piece of music). |
pmcid |
PubMed Central reference number. |
pmid |
PubMed reference number. |
printing-number |
Printing number of the item or container holding the item. |
producer |
Producer (e.g. of a television or radio broadcast). |
public-url |
A public url for this item. |
publisher |
The publisher of the item. |
publisher-place |
The geographic location of the publisher. |
recipient |
Recipient (e.g. of a letter). |
reviewed-author |
Author of the item reviewed by the current item. |
reviewed-genre |
Type of the item being reviewed by the current item (e.g. book, film). |
reviewed-title |
Title of the item reviewed by the current item. |
scale |
Scale of e.g. a map or model. |
script-writer |
Writer of a script or screenplay (e.g. of a film). |
section |
Section of the item or container holding the item (e.g. “§2.0.1” for a law; “politics” for a newspaper article). |
series-creator |
Creator of a series (e.g. of a television series). |
source |
Source from whence the item originates (e.g. a library catalog or database). |
status |
Publication status of the item (e.g. “forthcoming”; “in press”; “advance online publication”; “retracted”) |
submitted |
Date the item (e.g. a manuscript) was submitted for publication. |
supplement-number |
Supplement number of the item or container holding the item (e.g. for secondary legal items that are regularly updated between editions). |
translator |
Translator |
type |
The type of the item. |
url |
Uniform Resource Locator (e.g. “https://aem.asm.org/cgi/content/full/74/9/2766”) |
version |
Version of the item (e.g. “2.0.9” for a software program). |
volume |
Volume number of the item (e.g. “2” when citing volume 2 of a book) or the container holding the item (e.g. “2” when citing a chapter from volume 2 of a book). Use |
volume-title |
Title of the volume of the item or container holding the item. Also use for titles of periodical special issues, special sections, and the like. |
year-suffix |
Disambiguating year suffix in author-date styles (e.g. “a” in “Doe, 1999a”). |
description |
Website description |
favicon |
The path to the favicon for this website |
site-url |
Base URL for published website |
site-path |
Path to site (defaults to |
repo-url |
Base URL for website source code repository |
repo-link-target |
The value of the target attribute for repo links |
repo-link-rel |
The value of the rel attribute for repo links |
repo-subdir |
Subdirectory of repository containing website |
repo-branch |
Branch of website source code (defaults to |
issue-url |
URL to use for the ‘report an issue’ repository action. |
repo-actions |
Links to source repository actions ( |
reader-mode |
Displays a ‘reader-mode’ tool which allows users to hide the sidebar and table of contents when viewing a page. |
google-analytics |
Enable Google Analytics for this website |
cookie-consent |
Quarto includes the ability to request cookie consent before enabling scripts that set cookies, using Cookie Consent. The user’s cookie preferences will automatically control Google Analytics (if enabled) and can be used to control custom scripts you add as well. For more information see Custom Scripts and Cookie Consent. |
search |
Site search ( |
navbar |
Navbar options (see Navbar) |
sidebar |
Sidebar options (see Sidebar) |
body-header |
Markdown to insert at the beginning of each page’s body (below the title and author block). |
body-footer |
Markdown to insert below each page’s body. |
margin-header |
Markdown to place above margin content (text or file path) |
margin-footer |
Markdown to place below margin content (text or file path) |
page-navigation |
Provide next and previous article links in footer |
back-to-top-navigation |
Provide a ‘back to top’ navigation button |
bread-crumbs |
Whether to show navigation breadcrumbs for pages more than 1 level deep |
page-footer |
Page footer. Text content or page footer definition. |
image |
Default site thumbnail image for |
image-alt |
Default site thumbnail image alt text for |
comments |
|
open-graph |
Generate Open Graph metadata (see Open Graph options) |
twitter-card |
Generate Twitter Card metadata (see Twitter Card options) |
other-links |
A list of other links to appear below the TOC. |
code-links |
A list of code links to appear with this document. |
导航栏
定义书籍顶部导航栏的选项。例如:
_quarto.yml
书籍:
navbar:
search: true
导航项
导航项出现在navbar
定义的left
或right
键中,或sidebar
定义的contents
键中。例如:
_quarto.yml
书籍:
navbar:
right:
- icon: github
href: https://github.com/
aria-label: GitHub
请注意,icon
选项适用于导航栏中的项目,但侧边栏中的项目不支持icon
选项。
侧边栏
定义书籍侧边导航区域的选项。例如:
_quarto.yml
书籍:
sidebar:
search: true
侧边栏工具
出现在侧边栏上的操作按钮。例如:
_quarto.yml
书籍:
sidebar:
tools:
- icon: github
href: https://github.com/
页脚
书籍页面页脚定义。例如:
_quarto.yml
书籍:
page-footer:
center:
- text: "About"
href: about.qmd
- text: "License"
href: license.md
- text: "Trademark"
href: trademark.qmd
搜索
搜索选项在书籍
的search
键下指定。例如:
_quarto.yml
书籍:
search:
location: navbar
type: overlay
location |
Location for search widget ( |
type |
Type of search UI ( |
limit |
Number of matches to display (defaults to 20) |
collapse-after |
Matches after which to collapse additional results |
copy-button |
Provide button for copying search link |
keyboard-shortcut |
One or more keys that will act as a shortcut to launch search (single characters) |
show-item-context |
Whether to include search result parents when displaying items in search results (when possible). |
algolia |
Use an Algolia index for site search (see Algolia Options) |
Algolia 选项
您可以使用Algolia索引作为书籍搜索的后端。使用search
的algolia
子键指定Algolia选项,例如:
_quarto.yml
书籍:
search:
algolia:
index-name: <my-index-name>
application-id: <my-application-id>
search-only-api-key: <my-search-only-api-key>
index-name |
The name of the index to use when performing a search |
application-id |
The unique ID used by Algolia to identify your application |
search-only-api-key |
The Search-Only API key to use to connect to Algolia |
analytics-events |
Enable tracking of Algolia analytics events |
show-logo |
Enable the display of the Algolia logo in the search results footer. |
index-fields |
Fields to target for searches (see below for details) |
params |
Additional parameters to pass when executing a search |
index-fields
选项提供了Algolia索引中的子字段,用于搜索目标:
href |
Field that contains the URL of index entries |
title |
Field that contains the title of index entries |
text |
Field that contains the text of index entries |
section |
Field that contains the section of index entries |
社交
社交元数据作为书籍
选项的子键提供。您可以指定true
以使用一组默认选项生成社交元数据,或指定以下列出的一个或多个Twitter或Open Graph特定选项。例如:
_quarto.yml
书籍:
open-graph: true
twitter-card:
site: "@sitehandle"
Twitter 卡片
在twitter-card
键下设置Twitter选项:
_quarto.yml
书籍:
twitter-card:
site: "@sitehandle"
title |
The title of the page. Note that by default Quarto will automatically use the title metadata from the page. Specify this field if you’d like to override the title for this provider. |
description |
A short description of the content. Note that by default Quarto will automatically use the description metadata from the page. Specify this field if you’d like to override the description for this provider. |
image |
The path to a preview image for the content. By default, Quarto will use the |
image-alt |
The alt text for the preview image. By default, Quarto will use the |
image-width |
Image width (pixels) |
image-height |
Image height (pixels) |
card-style |
Card style ( If this is not provided, the best style will automatically selected based upon other metadata. You can learn more about Twitter Card styles here. |
creator |
|
site |
|
Open Graph
在open-graph
键下设置Open Graph选项:
_quarto.yml
书籍:
open-graph:
title: "Title for Open Graph"
title |
The title of the page. Note that by default Quarto will automatically use the title metadata from the page. Specify this field if you’d like to override the title for this provider. |
description |
A short description of the content. Note that by default Quarto will automatically use the description metadata from the page. Specify this field if you’d like to override the description for this provider. |
image |
The path to a preview image for the content. By default, Quarto will use the |
image-alt |
The alt text for the preview image. By default, Quarto will use the |
image-width |
Image width (pixels) |
image-height |
Image height (pixels) |
locale |
Locale of open graph metadata |
site-name |
Name that should be displayed for the overall site. If not explicitly provided in the |
评论
您可以使用Hypothesis、Utterances或Giscus为您的书籍添加评论功能。
Hypothesis
通过comments
键启用和配置Hypothesis评论。例如:
_quarto.yml
website:
comments:
hypothesis:
theme: clean
openSidebar: false
client-url |
Override the default hypothesis client url with a custom client url. |
openSidebar |
Controls whether the sidebar opens automatically on startup. |
showHighlights |
Controls whether the in-document highlights are shown by default ( |
theme |
Controls the overall look of the sidebar ( |
enableExperimentalNewNoteButton |
Controls whether the experimental New Note button should be shown in the notes tab in the sidebar. |
usernameUrl |
Specify a URL to direct a user to, in a new tab. when they click on the annotation author link in the header of an annotation. |
services |
Array of service definitions |
branding |
Custom branding/colors to apply to UI |
externalContainerSelector |
A CSS selector specifying the containing element into which the sidebar iframe will be placed. |
focus |
User focused filter set for the available annotations on a page |
requestConfigFromFrame |
Specify a host iframe to request configuration from |
assetRoot |
The root URL from which assets are loaded. |
sidebarAppUrl |
The URL for the sidebar application which displays annotations. |
有关上述Hypothesis选项的更多文档,请参阅Hypothesis Publisher Config文档。
Utterances
通过comments
键启用和配置Utterances评论。例如:
_quarto.yml
website:
comments:
utterances:
repo: quarto-dev/quarto-web
repo |
The Github repo that will be used to store comments. |
label |
The label that will be assigned to issues created by Utterances. |
theme |
The Github theme that should be used for Utterances ( |
issue-term |
How posts should be mapped to Github issues ( |
Giscus
通过comments
键启用和配置Giscus app的使用。例如:
_quarto.yml
website:
comments:
giscus:
repo: quarto-dev/quarto-web
repo |
The Github repo that will be used to store comments. In order to work correctly, the repo must be public, with the giscus app installed, and the discussions feature must be enabled. |
repo-id |
The Github repository identifier. You can quickly find this by using the configuration tool at https://giscus.app. If this is not provided, Quarto will attempt to discover it at render time. |
category |
The discussion category where new discussions will be created. It is recommended to use a category with the Announcements type so that new discussions can only be created by maintainers and giscus. |
category-id |
The Github category identifier. You can quickly find this by using the configuration tool at https://giscus.app. If this is not provided, Quarto will attempt to discover it at render time. |
mapping |
The mapping between the page and the embedded discussion.
|
reactions-enabled |
Display reactions for the discussion’s main post before the comments. |
loading |
Specify |
input-position |
Place the comment input box above or below the comments. |
theme |
The giscus theme to use when displaying comments. Light and dark themes are supported. If a single theme is provided by name, it will be used as light and dark theme. To use different themes, use
|
language |
The language that should be used when displaying the commenting interface. |
列表
列表 使您能够根据一组 Quarto 文档或其他自定义数据自动生成页面(或页面区域)的内容。您可以通过在文档前文中使用 listing
选项来启用页面上的列表。例如,设置 listing: default
将生成目录中所有文档的列表(当前文档除外):
---
title: "列表示例"
listing: default
---
要自定义列表,请在 listing
键下指定其他选项:
---
title: "列表示例"
listing:
contents: posts
type: grid
grid-columns: 2
---
id |
The id of this listing. When the listing is rendered, it will place the contents into a If no |
type |
The type of listing to create. Choose one of:
|
contents |
The files or path globs of Quarto documents or YAML files that should be included in the listing. |
sort |
Sort items in the listing by these fields. The sort key is made up of a field name followed by a direction For example: Use |
max-items |
The maximum number of items to include in this listing. |
page-size |
The number of items to display on a page. |
sort-ui |
Shows or hides the sorting control for the listing. To control the fields that will be displayed in the sorting control, provide a list of field names. |
filter-ui |
Shows or hides the filtering control for the listing. To control the fields that will be used to filter the listing, provide a list of field names. By default all fields of the listing will be used when filtering. |
categories |
Display item categories from this listing in the margin of the page.
|
feed |
Create an RSS feed for this page using the items in this listing (see Feed). |
date-format |
The date format to use when displaying dates (e.g. d-M-yyy). Learn more about supported date formatting values here. |
max-description-length |
The maximum length (in characters) of the description displayed in the listing. Defaults to 175. |
image-placeholder |
The default image to use if an item in the listing doesn’t have an image. |
image-lazy-loading |
If false, images in the listing will be loaded immediately. If true, images will be loaded as they come into view. |
image-align |
In |
image-height |
The height of the image being displayed (a CSS height string). The width is automatically determined and the image will fill the rectangle without scaling (cropped to fill). |
grid-columns |
In grid type listings, the number of columns in the grid display. Defaults to 3. |
grid-item-border |
In grid type listings, whether to display a border around the item card. Defaults to |
grid-item-align |
In grid type listings, the alignment of the content within the card ( |
table-striped |
In table type listings, display the table rows with alternating background colors. Defaults to |
table-hover |
In table type listings, highlight rows of the table when the user hovers the mouse over them. Defaults to false. |
template |
The path to a custom listing template. |
template-params |
Parameters that are passed to the custom template. |
fields |
The list of fields to include in this listing. |
field-display-names |
A mapping that provides display names for specific fields. For example, to display the title column as ‘Report’ in a table listing you would write:
|
field-types |
Provides the date type for the field of a listing item. Unknown fields are treated as strings unless a type is provided. Valid types are |
field-links |
The list of fields to display as hyperlinks to the source document when the listing type is a table. By default, only the |
field-required |
Fields that items in this listing must have populated. If a listing is rendered and one more items in this listing is missing a required field, an error will occur and the render will. |
include |
Items with matching field values will be included in the listing. |
exclude |
Items with matching field values will be excluded from the listing. |
订阅源
通过包含 feed
选项,为您的列表启用 RSS 订阅源:
---
title: "列表示例"
listing:
contents: posts
feed:
items: 10
---
items |
The number of items to include in your feed. Defaults to 20. |
type |
Whether to include full or partial content in the feed.
|
title |
The title for this feed. Defaults to the site title provided the Quarto project. |
image |
The path to an image for this feed. If not specified, the image for the page the listing appears on will be used, otherwise an image will be used if specified for the site in the Quarto project. |
description |
The description of this feed. If not specified, the description for the page the listing appears on will be used, otherwise the description of the site will be used if specified in the Quarto project. |
language |
The language of the feed. Omitted if not specified. See https://www.rssboard.org/rss-language-codes for a list of valid language codes. |
categories |
A list of categories for which to create separate RSS feeds containing only posts with that category |
xml-stylesheet |
The path to an XML stylesheet (XSL file) used to style the RSS feed. |
关于
为个人或组织布局一个简单的关于页面。在文档前文的 about
键下指定关于页面选项:
---
title: 关于
about:
template: jolla
image: profile.jpg
links:
- icon: twitter
text: twitter
href: https://twitter.com
---
更多信息,请参阅 关于页面 文档。
id |
The target id of this about page. When the about page is rendered, it will place read the contents of a If no such |
template |
The template to use to layout this about page. Choose from:
|
image |
The path to the main image on the about page. If not specified, the |
image-alt |
The alt text for the main image on the about page. |
image-title |
The title for the main image on the about page. |
image-width |
A valid CSS width for the about page image. |
image-shape |
The shape of the image on the about page.
|
links |
Links (as navigation items) to display on the about page. |