Open lumpiluk opened 12 months ago
You're right, the current unit storage is not as flexible as I'd like.
Storing the units in a CSV instead of in the code was not a choice I felt was the most usable, but rather the one lying in my abilities. Keeping track of global variables in Typst is really hard because you have multiple passes over the file. I am always to pull requests, though.
Would the second idea work? I'd assume that the path is relative to the main file where the library is imported, such that you can't easily find the bundled CSVs.
I'm looking for a way to add custom units (e.g., "hours") while importing unify from
@preview
. According to the Readme:However, when importing from
@preview
, these CSVs aren't available to me.Would it make sense to either
units
,units-short
, etc., asstate
and add a function for easily adding a new unit, prefix, or postfix; or_format-unit
defaulting to the existing dictionaries, which should allow users to useset
rules to specify the extended dictionaries?