Quarto Glob Syntax
Overview
Quarto sometimes allows you to provide a path or paths using glob syntax, providing wildcard expansion and other behavior that makes it simple to match a list of files without having to specify each file individually. Globs may be used:
- When specifying render targets in Quarto projects (see Render Targets).
- When defining resources for Quarto websites (see Site Resources).
- When defining documents to include in a listing (see Listing Contents).
- When automatically creating navigation for sidebars (see Auto Navigation).
Glob Syntax
The below is a general reference of the syntax used for globs in Quarto. Note that globs match the filesystem recursively. If you prefer that they don’t, then prefix the pattern with a /
(for example, use /*.qmd
rather than *.qmd
).
*
- Matches everything.{foo,bar}
- Matchesfoo
orbar
.[abcd]
- Matchesa
,b
,c
ord
.[a-d]
- Matchesa
,b
,c
ord
.[!abcd]
- Matches any single character besidesa
,b
,c
ord
.[[:<class>:]]
- Matches any character belonging to<class>
.[[:alnum:]]
- Matches any digit or letter.[[:digit:]abc]
- Matches any digit,a
,b
orc
.- See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes for a complete list of supported character classes.
\
- Escapes the next character for anos
other than"windows"
.- ` - Escapes the next character for
os
set to"windows"
. /
- Path separator.\
- Additional path separator only foros
set to"windows"
.?(foo|bar)
- Matches 0 or 1 instance of{foo,bar}
.@(foo|bar)
- Matches 1 instance of{foo,bar}
. They behave the same.*(foo|bar)
- Matches n instances of{foo,bar}
.+(foo|bar)
- Matches n > 0 instances of{foo,bar}
.!(foo|bar)
- Matches anything other than{foo,bar}
.**
- Matches any number of any path segments.- Must comprise its entire path segment in the provided glob.
- See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option.