mirror of
https://github.com/typst/typst
synced 2025-08-14 15:17:57 +08:00
Compare commits
3 Commits
0214320087
...
95a7e28e25
Author | SHA1 | Date | |
---|---|---|---|
|
95a7e28e25 | ||
|
37bb632d2e | ||
|
24b2f98bf9 |
@ -78,7 +78,8 @@ impl PackageStorage {
|
||||
self.package_path.as_deref()
|
||||
}
|
||||
|
||||
/// Make a package available in the on-disk.
|
||||
/// Makes a package available on-disk and returns the path at which it is
|
||||
/// located (will be either in the cache or package directory).
|
||||
pub fn prepare_package(
|
||||
&self,
|
||||
spec: &PackageSpec,
|
||||
@ -111,7 +112,7 @@ impl PackageStorage {
|
||||
Err(PackageError::NotFound(spec.clone()))
|
||||
}
|
||||
|
||||
/// Try to determine the latest version of a package.
|
||||
/// Tries to determine the latest version of a package.
|
||||
pub fn determine_latest_version(
|
||||
&self,
|
||||
spec: &VersionlessPackageSpec,
|
||||
@ -144,7 +145,7 @@ impl PackageStorage {
|
||||
}
|
||||
|
||||
/// Download the package index. The result of this is cached for efficiency.
|
||||
pub fn download_index(&self) -> StrResult<&[serde_json::Value]> {
|
||||
fn download_index(&self) -> StrResult<&[serde_json::Value]> {
|
||||
self.index
|
||||
.get_or_try_init(|| {
|
||||
let url = format!("{DEFAULT_REGISTRY}/{DEFAULT_NAMESPACE}/index.json");
|
||||
@ -165,7 +166,7 @@ impl PackageStorage {
|
||||
///
|
||||
/// # Panics
|
||||
/// Panics if the package spec namespace isn't `DEFAULT_NAMESPACE`.
|
||||
pub fn download_package(
|
||||
fn download_package(
|
||||
&self,
|
||||
spec: &PackageSpec,
|
||||
cache_dir: &Path,
|
||||
|
@ -94,7 +94,7 @@ pub struct BibliographyElem {
|
||||
/// - A path string to load a bibliography file from the given path. For
|
||||
/// more details about paths, see the [Paths section]($syntax/#paths).
|
||||
/// - Raw bytes from which the bibliography should be decoded.
|
||||
/// - An array where each item is one the above.
|
||||
/// - An array where each item is one of the above.
|
||||
#[required]
|
||||
#[parse(
|
||||
let sources = args.expect("sources")?;
|
||||
|
@ -388,7 +388,7 @@ pub struct OutlineEntry {
|
||||
/// space between the entry's body and the page number. When using show
|
||||
/// rules to override outline entries, it is thus recommended to wrap the
|
||||
/// fill in a [`box`] with fractional width, i.e.
|
||||
/// `{box(width: 1fr, it.fill}`.
|
||||
/// `{box(width: 1fr, it.fill)}`.
|
||||
///
|
||||
/// When using [`repeat`], the [`gap`]($repeat.gap) property can be useful
|
||||
/// to tweak the visual weight of the fill.
|
||||
|
@ -188,7 +188,7 @@ pub struct RawElem {
|
||||
/// - A path string to load a syntax file from the given path. For more
|
||||
/// details about paths, see the [Paths section]($syntax/#paths).
|
||||
/// - Raw bytes from which the syntax should be decoded.
|
||||
/// - An array where each item is one the above.
|
||||
/// - An array where each item is one of the above.
|
||||
///
|
||||
/// ````example
|
||||
/// #set raw(syntaxes: "SExpressions.sublime-syntax")
|
||||
|
@ -44,7 +44,7 @@ I am #amazed(color: purple)[amazed]!
|
||||
Templates now work by wrapping our whole document in a custom function like
|
||||
`amazed`. But wrapping a whole document in a giant function call would be
|
||||
cumbersome! Instead, we can use an "everything" show rule to achieve the same
|
||||
with cleaner code. To write such a show rule, put a colon directly behind the
|
||||
with cleaner code. To write such a show rule, put a colon directly after the
|
||||
show keyword and then provide a function. This function is given the rest of the
|
||||
document as a parameter. The function can then do anything with this content.
|
||||
Since the `amazed` function can be called with a single content argument, we can
|
||||
|
Loading…
x
Reference in New Issue
Block a user