This article is for authors whose prose cannot call R: a Quarto
document on the Jupyter or Julia engine, a plain Pandoc document, or a
chapter built from a values file. It is also for knitr authors: in a
knitr document a name reads R, as `r x` does; elsewhere
code publishes it. It assumes you know
vignette("values", package = "weft") and
vignette("wording", package = "weft"). After it you will be
able to write a value in a sentence by name, publish it from Python,
Julia or a pipeline, say what the resolver does with it, and know what
fails and what is not built yet.
None of the code in this article is run when the article is built. The output shown was produced by running it.
A name instead of an R expression
A named value is a code span that holds one name, directly followed
by an attribute block with a weft class: `depth`{.num}.
Where R runs, R reads the name; elsewhere code publishes a value under
it. When the document renders, R or a Pandoc filter replaces the span
with the value, formatted by the class.
---
title: "Creek survey"
---
````{.weft-values}
{"weft":1,"values":{"depth":{"t":"float","v":"3.14159"},"n_high":{"t":"int","v":"1"}}}
````
Mean depth was `depth`{.num digits="2"} m.
[No site | One site | # sites]{n="n_high"} read above the trigger.That document needs no R, no Python and no Julia. It renders as:
Mean depth was 3.14 m. One site read above the trigger.
The block in the middle is how code hands a value over. You rarely
write one by hand: put() in Python, @put in
Julia and weft_values_write() in R write it for you, and in
a knitr document the hooks write what is needed. A name is ASCII
letters, digits, _ and ., starting with a
letter or _, and at most 64 characters. A dot is part of
the name: n.sites is one name, and there is no
site.depth that reaches into a value. A name cannot be
TRUE, FALSE, True,
False, true, false,
NA, NULL, None,
nothing, missing, Inf or
NaN.
.val prints a named value as it is: the digits of an
integer, the shortest text of a float, a decimal as written, a string,
an ISO date, true or false. It takes no
wording class. A float prints in one form whatever language wrote it:
100000, not 100000.0, and 1e+23,
as R writes it. Published text is data, not markdown, so
.val with a text or collapse class (.cap,
.and) prints a * or a < in a
string as it is.
When to write a name
- In a knitr document (an
.Rmd, or a.qmdwithengine: knitr), write names or R expressions as you like:`x`{.num}and`r x`{.num}print the same, except for objects of R itself (see “Names in a knitr document”). Write a name for a value used above the code that sets it, and in front matter. - In a document that is not knit (the Jupyter engine, the Julia engine, the markdown engine or plain Pandoc), write names. No R runs there to evaluate an expression.
One name with one record prints one text in every document and on
every engine, for the classes the filter implements. R carries more than
the filter: a units quantity, a unit ladder, a dictionary
entry and a project formatter print only where R reads the name; where
the filter resolves the name they are a value error.
Names in a knitr document
In a knitr document R reads a named value, as `r x`
reads an expression, with every formatter: units, the dictionary and
project formatters work. You publish nothing:
---
title: "Creek survey"
output: md_document
knitr:
opts_knit:
weft: !expr weft::weft_setup()
---
```{r setup, include = FALSE}
turbidity <- c(Upper = 4.2, Middle = 7.9, Lower = 12.6)
worst <- max(turbidity)
n_high <- sum(turbidity > 10)
```
The worst reading was `worst`{.num} NTU.
[No site | One site | # sites]{n="n_high"} read high.R looks the name up in the knit’s environment and the environments it
encloses, as far as the global environment, and stops there: a name is
never read from base R, a package or a dataset. So
`pi`{.num}, `T`{.val} and
`rivers`{.num} are not read by name, while
`r pi` still reads base R’s pi. To use an
object a package exports, bind it in a chunk:
n <- pkg::n.
A function is not a value. If f is a function in R,
`f`{.num} is left for the filter, and so is a name R does
not bind where the sentence stands. That is how a name used above its
value works (see “A name used above its value” below).
Front matter and a caption the hooks do not resolve (a chunk that is
cached, not evaluated or not R) take the name’s last published value.
The hooks publish what the filter needs for these and for a name R left,
and nothing else: never a name in the governor of a span in prose, which
R reads itself. So a document with no named value in front matter or in
such a caption writes no weft-values block.
A pipeline that feeds a document it never runs writes a values file
with weft_values_write() (see “Values files” below). A
named vector of length 1 publishes as a list of one, with its name as
the key, as a longer named vector does. Under a scalar class the filter
prints a list of exactly one element as that element, so
.num works on it and .pairs keeps the
name:
weft_values_write("_weft/values/survey.json", worst = c(Upper = 12.6))The worst reading was Upper (12.6).
A values file accepts a bool, a whole or decimal number, a string, a
factor, a Date, an integer64 or an atomic
vector of these, up to 10,000 elements. NA,
NaN, Inf and NULL publish as
missing. A value with units is refused. Any other object, such as a data
frame, a list, a complex number or a raw vector, publishes as an error
that is reported where the name is used.
Text a chunk prints
A chunk with results = "asis" that prints sentences, one
per site or one per model, writes text that knitr’s hooks never see as
prose. Typing the numbers into that text with paste() or
sprintf() loses every check. In R, pass the text through
weft(). It resolves the markup where the call runs, reads
each name there, and returns an object that prints as markdown in a knit
(and as plain text anywhere else). Its constructs are R, so units, the
dictionary and project formatters all work, and in a loop each line
keeps its own values:
```{r, results = "asis"}
ntu <- c(8.2, 7.9, 9.1)
for (n_sites in 2:4) {
mean_ntu <- ntu[n_sites - 1]
cat(format(weft("We sampled `n_sites`{.word} sites, mean `mean_ntu`{.num} NTU."),
target = "markdown"), "\n")
}
```It prints:
We sampled two sites, mean 8.2 NTU.
We sampled three sites, mean 7.9 NTU.
We sampled four sites, mean 9.1 NTU.
A named value in text that R prints without weft() is
not read, and the hooks publish nothing for it, so the filter fails it
with “no value” and the hint says to pass the text through
weft(). The string-markup lint finds the
literal case before the render (see “The lints”).
Under weft() a failed check, a missing value or a value
error is collected as it is in prose and marked with the chunk that
printed it. A name that is not bound where weft() was
called is a “no value” failure, and so is a function.
From a Python or Julia chunk, publish first, in a chunk with
results: asis, then print the text. The block is printed at
once, so the text after it sees the name:
Publishing from Python
For a notebook on the Jupyter engine, install the Python package in
the Python Quarto uses. The distribution is weft-prose; the
module is weft:
pip install "git+https://github.com/vorpalvorpal/weft#subdirectory=inst/python"
put() publishes names. A cell that calls it shows
nothing to the reader; the filter removes the block it prints. Hide the
code with echo: false.
---
title: "Creek survey"
jupyter: python3
---
```{python}
#| echo: false
from decimal import Decimal
from weft import put
depth = 3.14159
sites = ['Upper', 'Lower', 'Weir']
big = 2**70
price = Decimal('0.10')
put(depth=depth, sites=sites, big=big, price=price)
```
Mean depth was `depth`{.num digits="2"} m at `sites`{.and}.
The count was `big`{.val} and the price `price`{.num digits="2"}.It renders as:
Mean depth was 3.14 m at Upper, Lower and Weir. The count was
1180591620717411303424 and the price 0.10.
put(depth=depth), put({'n.sites': 4}) and a
mix of the two are all accepted. A name that is not a name raises
PublishError, and nothing is published from that call.
auto() publishes for you. Call it once, in an early
cell:
After each cell, auto() publishes the names the document
uses that the cell changed. It reads the document’s source from Quarto’s
environment, or from a path you give it:
auto("report.qmd"). Call it in a cell that has output. A
cell with include: false or output: false
publishes nothing on this engine.
On the Jupyter engine auto() has a gate. It publishes
only when the source holds at least one named value, and a governor name
alone, such as if="rising", does not switch it on. A list
of more than 10,000 elements raises an error from auto(),
as it does from put(); no error record is published.
In a knitr document (an .Rmd, or a .qmd
with engine: knitr), put() and
auto() in a Python chunk, and put and
@put in a Julia chunk, hand their names to the hooks. The
hooks write them as one block before the next block of prose, and
nothing is printed in the chunk except by put() in a chunk
with results: asis. A chunk with
include: false still publishes. Under knitr,
auto() publishes, at the end of each Python chunk, the
names R gives it that are bound in Python’s __main__ and
changed: the name of every named value in the source, and the names in a
governor of a span in a Python or Julia chunk’s code or in a chunk’s
options. Julia has no auto().
Publishing from Julia
Julia has put and @put:
---
title: "Creek survey"
engine: julia
---
```{julia}
#| echo: false
using Weft
depth = 3.14159
n_high = 1
@put depth n_high
```
Mean depth was `depth`{.num digits="2"} m.
[No site | One site | # sites]{n="n_high"} read above the trigger.@put a b publishes each variable under its own name.
Weft.put(depth=3.14159) and
Weft.put(:depth => 3.14159) publish a name and a value.
Julia has no auto().
Set-up
On the engines, three things must be in place: weft’s filter in the
project, the Python or Julia package in the language the notebook uses,
and, for the gate and verify(), R with weft installed.
Quarto project. Run weft::use_quarto().
It writes the extension _extensions/weft-check/, which
holds the filters weft.lua and weft-check.lua
and the folder weftlib/, and names it under
filters: in _quarto.yml. weft.lua
runs first. The extension also holds weft-output.lua, the
rendered-output check, which _quarto.yml names by its path
to run after Quarto’s own filters (see
vignette("gate", package = "weft")).
use_quarto() also prints the install line for the language
packages when the project has a document that needs them.
R Markdown. Run weft::use_setup(). For
an .Rmd outside a Quarto project it copies
weft.lua, weft-check.lua,
weft-output.lua and weftlib/ beside the
document and names them in pandoc_args. A document set up
before named values that names only weft-check.lua gets
weft.lua added before it, and one set up before the
rendered-output check gets weft-output.lua added last.
Python. The pip line above.
weft::status() gains a python row when the
project has a Jupyter-engine document, and says whether
import weft runs in the Python Quarto would use. Under
knitr you need no pip install: R loads its own copy of the package from
weft.
Julia. using Weft has to find the
package. The line use_quarto() prints is:
Setting JULIA_LOAD_PATH in your shell does not help,
because the notebook worker that Quarto starts does not inherit it. The
julia: key in _quarto.yml does reach the
worker. To use the copy that ships with the R package, point the worker
at it:
The path is system.file("julia", package = "weft") in R.
The trailing separator (:, and ; on Windows)
keeps Julia’s own default load path. This is how weft’s own tests make
using Weft work on the engine. Under knitr you need
nothing: R puts the package on the load path itself.
R is still needed on a machine that runs the commit gate,
lints(), or verify(), even for a project with
no R code.
What the filter resolves
weft.lua resolves named values wherever R does not read
them. In a document that is not knit it resolves every weft construct.
In a knitr document it resolves the named values the hooks leave (front
matter, a caption the hooks do not resolve, a name R does not bind where
it stands) and any span that reaches Pandoc still carrying a
governor.
It implements the number, wording, collapse and text classes:
.num, .pct, .val,
.sci, .p, .date,
.plus, .no, .word,
.count, .ord, .and,
.or, .pairs, .range,
.ul, .ol, .dl, .a,
.cap, .strong, .em; the keys
digits, sigfig, label (on
.p), sep, last,
trunc, none; the governors if,
n, sign and list, ids and
back-references; cite spans; and decision on a
cite span or a .weft-literal, which it removes
from the output. It reads the settings p_digits and
p_label. A float prints as R prints it. An integer or a
decimal prints exactly, whatever its size.
Where the filter’s grammar differs from R’s
On the R path the value of if is any R expression. In
the filter it is smaller, and everything else is an error. A condition
is:
- a name whose value is a bool, or
!directly before such a name, or - one comparison
a OP b, whereOPis<,<=,>,>=,==or!=, and each side is a name, a number such as10or1.5, or a string in quotes such as'north'or"north", with at least one side a name.
Conditions are joined by commas, as on the R path.
[above | within]{if="worst > limit"}
[a gap | no gap]{if="n_gap > 10, n_sites >= 3"}
[north | south]{if="region == 'north'"}
[the backlog cleared | the backlog grew]{if="n_open < 5, !paused"}
[before | after]{if="sampled < '2026-07-01'"}! applies to one bool name only. !paused is
true when paused is false. !!a,
!a == b and !(a) are construct errors, because
R and Julia read !a > b differently. A one-arm guard can
use it too: [Sampling ran on schedule]{if="!delayed"} fails
when delayed is true.
Numbers compare exactly, as decimals. A float is compared by its
shortest text, so 0.1 is equal to the decimal
0.1 and to the literal 0.1. Strings compare
with == and != only. Dates compare in calendar
order. A date compares with a string literal that is a valid
YYYY-MM-DD date, on either side of the operator, in
calendar order. Any other string literal, an impossible date such as
'2026-02-30', or a string name is a value error. A bool is
not truthy: 0, "" and a list of one bool are
errors, not false.
There are no arbitrary expressions. worst + 1 > 3,
len(x) > 2, a && b,
0 < x < 1 and 3 > 2 are construct
errors. The fix is always the same: compute it in code and publish the
result under a name.
Governor values are also names. n takes a name,
. or #id. sign takes a name or
#id. list takes a name. A governor value that
starts with a space, such as n=" k", is a construct error.
Pandoc does not read such a value as an attribute, so the span would
print as text.
More differences:
- Units (
.uname,.usym,.nounit, and the keyunit=on a named value or on ann,signorlistspan) and project formatters are not available. They fail loudly and never print the raw value. -
.num,.pct,.sciand.pon a list with no collapse class print each element, joined by a comma and a space, as R does:`depths`{.num}prints1.3, 3.5. A list of strings under one of these classes is a value error. -
date_formatreads the tokens%d,%-d,%e,%m,%-m,%B,%b,%A,%a,%Y,%y,%jand%%, and literal text, in English. Withdate_format: "%A %-d %B %Y"a.dateprintsThursday 29 February 2024. Any other token, such as%Uor%H, is a value error that says it is not available. -
.ord,.word,.count,.rangeand thenandsigngovernors work from the exact digits of an integer..ordof 9007199254740993 prints9,007,199,254,740,993rd, with no rounding past 2^53. - Order matters. A construct sees the latest value published above it.
A name used above every publication of it takes the value published
below, when there is exactly one (see “A name used above its value”
below). Captions the hooks do not resolve and the front-matter fields
title,subtitle,abstractanddescriptionsee each name’s last published value, so a named value works in any caption on any chunk. A named value in another front-matter field is a failure that says the filter does not resolve that field. - A named value in an arm that is not chosen is never read.
Richer conditions: publish a bool
A condition the filter reads is a comparison of a name against a name
or a literal, with one of six operators: <,
<=, >, >=,
== and !=. A bool name on its own, or with
! before it, is a condition too. For anything richer,
compute it in code and publish the answer as a bool:
weft_values_write("_weft/values/survey.json",
all_rising = all(trend$slope > 0),
in_band = in_range(do_mean, dict$do_band))The code that computes the bool is where the reasoning lives, and it
can be read and tested there. In a knitr document none of this is
needed: an if span takes any R expression.
A name used above its value
A summary at the top of a document often states a value that a chunk further down computes. A named value can be used above the code that publishes it, provided the name takes exactly one value in the document:
In a knitr document R does not bind n_sites where the
sentence stands, so the hooks leave it, publish it once the chunk has
run, and the filter takes the value from below. The filter looks ahead,
finds the one value published under n_sites, and prints it.
This works on every engine. Several publications count as one value when
they agree: a Python put() in a loop that publishes the
same value each time, or a values file and a block that agree. A missing
value counts as a value.
When the document publishes different values under the name below the use, the filter cannot tell which one the sentence means, and the render fails:
weft: 1 failure
b.md:1 [no value] `n`{.count}
`n` is used above its first publication, and the document publishes 2 different values for it below; a use above every publication needs a name that takes one value (rule 1.12.7).
Move the sentence below the value it means, or publish that value under a name of its own.
A use below a publication is unchanged: it takes the latest value above it.
Inline R is not covered. `r n_sites` above the chunk is
evaluated where it stands, before n_sites exists. When it
fails with “object not found”, the hint says to write it as a named
value instead.
One trap is left under knitr. If you render with
rmarkdown::render() in a session that still holds an old
n_sites, R reads that old value above the chunk. When the
document sets n_sites again below, weft fails the render
and says so; render in a fresh session, as the Knit button and
quarto render do.
Checks
A check made where code runs counts there. In Python,
claim(x, "> 10") returns x and raises when
the check fails; a string that starts with a comparison operator applies
to the value, and any other string is an expression in which
_ is the value:
from weft import claim
n = claim(n, "> 10")
even = claim(n, "_ % 2 == 0")
depth = claim(depth, "> 0", "< 50", level="warn") # record, and go onIn Julia the check is an expression, and _ stands for
the value:
A failure is recorded in a block, and the filter reports it with the
cell’s label. In R chunk code, claim() is as it always was.
In a knitr document a check that should count where a value is used is
written there, as a claim in the inline R or as a guard span:
A check can also travel with the value in a values file:
claim() given directly to weft_values_write()
is captured, and counts each time the name is used in a sentence:
weft_values_write("_weft/values/survey.json", worst = claim(worst, . < 50))A check in the sentence is a guard around the value.
[x]{if="worst < 50"} that is false fails the render, as
any claim does:
The detail line of the report names each value the guard read, as
claim() names its value:
worst < 50 was false (worst = 52.5). With two names it
reads
n_gap < n_sites was false (n_gap = 12, n_sites = 3).
Each failing part of a comma list is its own failure, with the names
that part read. A bool prints as true or false
and a date as ISO text.
The filter does not read a claim= or level=
key. On a named value or on a span it resolves, either key is a
construct error that says so, because the check would never run. Use a
guard span, or claim() in code. On an R value in a knitr
document, level passes through as it did.
checks() lists these guards with the rest of a project’s
checks, grouped by the name they check (see
vignette("wording", package = "weft")).
What failure looks like
The filter does not stop at the first problem. It marks each failure
in the text with <<weft: KIND, line N>>,
finishes, and reports once on standard error. The kinds are
failed claim, no value,
value error and construct error:
weft: 1 claim failed
survey.qmd:12 `worst`{.num}
_ < 50 was false (value 52.5)
Read each sentence. If FALSE is right, rewrite the sentence.
Do not loosen a claim to clear this.
The render then fails. In draft mode it does not fail: the markers,
the report and the stamp are the same, but the exit is clean. Draft mode
is on when the environment variable WEFT_DRAFT is
1 or true, or draft: true is in
_weft.yml or the document’s weft: key. The
filter reads those two as text, not through Pandoc’s metadata. A
weft: mapping in flow style is read as the block form
is.
Under quarto render in a project set up with
use_quarto(), the report prints once, from the post-render
script, which collects every document’s failures. With plain Pandoc, or
a Quarto render with no post-render script, the filter prints it.
A failure’s line is found by searching the source, its includes
(followed as Quarto expands them, every path read from the main
document’s folder) and its chunk options for the construct’s text. Text
that a chunk printed has no line, and the report names the file only. If
a construct’s text also appears later in the source, a printed construct
takes that later line. A span in a pipe-table cell whose attribute holds
\| is found too.
The traps
A name published nowhere in the document:
no value is published under the name `depth` in this document (rule 1.12.7).
Publish it in code in this document: put(depth=...) in Python, @put depth in
Julia, or a values file; under knitr, set it in an R chunk, and pass text an R
chunk prints through weft(). A cell with include: false or output: false
publishes nothing on the jupyter and julia engines.
A condition outside the grammar:
`worst + 1 > 3` is not a name or one comparison of names, numbers and
'strings'; bind the condition to a name in code (rule 1.12.4).
A class the filter does not implement:
`.uname` on a named value is not available in this version of weft.lua
(rule 2.13.3).
A hidden cell is the usual cause of the first. On the Jupyter and
Julia engines a cell with include: false or
output: false publishes nothing, because its output never
reaches Pandoc. Publish in a cell that shows its output, and use
echo: false to hide the code.
Values files
A pipeline can publish values for a document it never runs. Write a values file, then read it from the document at the point where the values should begin to count.
weft_values_write("_weft/values/survey.json", n = nrow(d), worst = max(d$ntu))````{.weft-values file="_weft/values/survey.json"}
````
Mean depth was `worst`{.num} NTU at `n`{.word} sites.weft_values_write() works outside a knit and in a
targets pipeline. The file is JSON, in the same form as the
block. A relative path in the document is taken from the document’s
folder, and a path that starts with / from the project
root, which is the folder with _weft.yml, else
_quarto.yml, else the document’s own. The file must resolve
inside the root. A ../ that stays inside is fine. A path
that leaves the root, a drive or // form, a missing file, a
directory, a file over 5,000,000 bytes, or a file that is not schema 1
is a failure that names the file and the reason. The size is checked
before the file is read. The filter does not follow symbolic links. A
body on a file= block is also a failure. The
named-unpublished lint refuses a file outside the root too,
so it does not count the names in it.
A values file is left out of freshness. Its own run id is not compared with the current run, so a file a pipeline wrote earlier does not make the document “not fresh” or print the notice below.
Chapters of a book share values only by each reading the same file. The ledger header lists each file read, by its path from the root, with its hash.
Captions and front matter
A named value works in any caption, on any chunk, and in the
front-matter fields title, subtitle,
abstract and description. In a caption the
hooks resolve (an R chunk that runs and is not cached), R reads the name
after the chunk, in the chunk’s environment. In any other caption, and
in all front matter, the filter resolves the name after the body, so
each sees the last value published under it.
A named value in math and raw LaTeX
A named value works inside a formula and inside raw LaTeX. Pandoc
keeps the backticks in the text of a $...$ or
$$...$$ formula, so the filter finds the named value there,
and writes the TeX that a class block writes in math (see
vignette("values"), “Values in math and raw LaTeX”), not
markdown:
````{.weft-values}
{"weft":1,"values":{"share":{"t":"float","v":"0.123"},"volume":{"t":"float","v":"1234567"}}}
````
The share was $s = `share`{.pct}$ of the flow, and the volume
$$ V = `volume`{.sci} $$gives the formulas s = 12.3\% and
V = 1.2 \times 10^{6}. In a knitr document R reads the name
there, as it does in prose, so share and
volume need no block when R binds them; the filter resolves
the name only where R left it. The same holds in a math environment such
as align and in raw LaTeX (a {=latex} fence,
another \begin{...} environment, a code span followed by
{=latex}), where the output is wrapped in
\ensuremath{...}.
The checks are those of math written with inline R: the classes that
print words, emphasis or a list are a construct error, and so is a class
or key that is not weft’s. .val is allowed, and prints
\text{...} for anything but a plain number. A failure is
the marker \text{<<weft: no value, line 7>>}
inside the formula, which is not split. The name counts in the ledger
and the stamp (context math, or tex in raw
LaTeX), and a use above the publication follows the rule of the section
above. With the filter not installed, or not run before
weft-check.lua, a named value left in a formula is a
finding of weft-check: “math holds a named value the filter
did not resolve”.
Freeze, kept kernels and verify()
A value published in an earlier render can reach a later one: a
document served from _freeze, a cache, or a Jupyter kernel
or Julia server that kept its state. Each publisher records a run id,
from .weft/run, else WEFT_RUN. When a block’s
run is not the current one, the filter prints a notice once, to standard
error. The notice fails nothing in an ordinary render. Its checks did
not run now.
verify() fails on it. Before rendering,
verify() writes .weft/run, restarts Jupyter
kernels, and, for a document on the Julia engine, kills the Julia
server. That ends any other Julia notebook open in that server, and the
report says so.
R and Python in one knitr document
In a knitr document a Python or Julia chunk can publish a name that R
also binds. The later wins where the sentence stands: R’s binding when
its value changed after the guest published, else the published value. A
scratch n set early in R does not shadow a
put(n=...) made later in Python.
The setting names_from says where a document’s named
values come from. It goes in _weft.yml or under the
document’s weft: key. The default is the engine’s language,
r. With names_from: python (or
julia) R reads no named value in prose or captions: every
one is left for the filter, and Python fills it by put() or
auto(). weft() always reads R. Governors
(if, n, sign, list)
stay R expressions under every setting; read a Python value there with
py$. A value other than r, python
or julia is a configuration error.
The lints
Four lints read named values, without rendering:
| Id | Tier | Finds | What to do |
|---|---|---|---|
named-unpublished |
2 | a name used in a sentence that no executed chunk, hand-written block or values file mentions | set it in an R chunk, or publish it with put() or
@put; the lint fires once per name, at its first use |
string-markup |
2 | in a knitr document, a string in an R chunk that holds a named value
or a span with n, if, sign or
list and is not given to weft()
|
give the string to weft() and print the object |
publish-hidden |
1 | a put, weft.put, @put or
Weft.put in a cell with include: false or
output: false, on the Jupyter or Julia engine |
publish in a cell that shows its output |
publish-hidden-auto |
2 | the same, for auto()
|
the same, or call auto() in a shown cell |
publish-hidden also fires on a hidden cell that assigns
a name the prose uses, in a document that calls auto().
Without the lint the render would print an earlier value of that name
with no error: see Limits.
A name can come from a helper script or a
from helpers import *, which a search cannot see. That is
why named-unpublished is tier 2: the render still fails
loudly if the name is missing. string-markup is tier 2 for
a like reason: a string kept in a variable and given to
weft() later reads as one that is not.
The engine rule accepts a .qmd with no
engine: knitr when every construct in it is a named value
or a span in the filter’s grammar, and the filter is installed. It still
stops one that holds an R value, or a span outside the grammar, and its
hint now says to write each value as a name. A document with named
values and no filter installed is a finding of its own: run
use_quarto().
The gate counts a named value as a value, and claim( in
a Python chunk and @claim in a Julia chunk as claim calls.
A hand-written block and a values file are not counted.
Limits
- On the Jupyter engine,
auto()cannot know that a hidden cell’s output was dropped. If a cell withinclude: falseoroutput: falsechanges a name that an earlier cell published, the prose keeps the earlier value, with no error. Thepublish-hiddenlint finds the cell; publish in a cell that shows its output. - A construct’s line is the next occurrence of its text. Text printed by a chunk that also appears later in the source takes the later line.
- Julia has no
auto(), and neither language has achecked()that makes a check count where the name is used.claim()from Python and Julia is checked where it runs. - Units, the dictionary and project formatters work only where R reads the name; where the filter resolves it they are a value error.
- In a knitr document R’s binding counts as later than a guest’s
publication only when its value changed. An R chunk that assigns a name
the value it already had does not count, so a Python
put()made between the two stands. - R does not read a named value in a string given to Python’s
weft_str(): its names are Python’s. - The filter does not follow symbolic links when it reads a values file.
- Inline R used above the code that defines its value is not resolved later; only a named value is.
- Tables in a Jupyter or Julia document are recorded in the ledger by the filter, with the limits in the languages article. A table that a script fills in after the page loads is recorded by the HTML it holds.
- A guest
claimcounts in the commit gate only in an executed chunk, so turningevaloff on a Python chunk with a claim reads as a removal. -
.sciprints some whole mantissas inconsistently (1 x 10^10but1.0 x 10^6), and.pctof a value near 1e15 rounds one digit early. - The Jupyter and Julia engines run on the author’s machine only. The
CI job that
use_ci()writes runs the static checks, and installs no Quarto, Jupyter or Julia. - The Julia package is installed from git. Nothing is published to PyPI or a Julia registry.