{"id":16472826,"url":"https://github.com/christopherkenny/typst-function","last_synced_at":"2025-02-28T04:42:18.562Z","repository":{"id":247329705,"uuid":"825176436","full_name":"christopherkenny/typst-function","owner":"christopherkenny","description":"A Quarto filter to insert Typst functions from divs and spans","archived":false,"fork":false,"pushed_at":"2024-07-08T03:44:38.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T00:48:46.661Z","etag":null,"topics":["quarto","quarto-extension","quarto-filter","typst"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christopherkenny.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-07T02:50:59.000Z","updated_at":"2024-07-31T11:39:56.000Z","dependencies_parsed_at":"2024-07-08T06:06:19.546Z","dependency_job_id":null,"html_url":"https://github.com/christopherkenny/typst-function","commit_stats":null,"previous_names":["christopherkenny/typst-function"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkenny%2Ftypst-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkenny%2Ftypst-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkenny%2Ftypst-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christopherkenny%2Ftypst-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christopherkenny","download_url":"https://codeload.github.com/christopherkenny/typst-function/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241101664,"owners_count":19909943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quarto","quarto-extension","quarto-filter","typst"],"created_at":"2024-10-11T12:18:41.337Z","updated_at":"2025-02-28T04:42:18.539Z","avatar_url":"https://github.com/christopherkenny.png","language":"Lua","readme":"# typst-function Extension For Quarto\n\n`typst-function` is a designed to be an analogous extension to Quarto's `latex-filter` extension [(quarto-ext/latex-environment)](https://github.com/quarto-ext/latex-environment).\nIt allows `divs` and `spans` to be converted to `typst` functions from within Quarto.\nThe syntax is similar to `latex-environment`, where you can specify argument's in a document's metadata to control which divs/spans are converted to function calls.\nThis uses the `functions` key in the YAML metadata to avoid conflicts with the familiar LaTeX extension.\n\nIf you have suggestions or problems, please open an issue.\n\n## Installing\n\nTo add this filter, run:\n\n```bash\nquarto add christopherkenny/typst-function\n```\n\n## Using\n\n### Basic use\nDivs that match names listed in the `functions` key are translated to Typst functions of the same name.\nAdding this to your metadata:\n\n```yaml\nfunctions: align\n```\n\nAllows you to write:\n\n```md\n::: {.align arguments=\"right\"}\nthis\n:::\n```\n\nSpans function similarly, so you can style like:\n\n```md\n[other text]{.align arguments=right}\n```\n\n### Spreading arguments (experimental)\n\nOne harder case to work with is when arguments are spread.\nIn those cases, the function takes the form `#function(args, ..spread[body])`\nThis is currently and only experimentally supported by adding `spread=true`.\nThe filter inserts the body before the closing parentheses. In the case where the `..spread` involves an open `map()`, it uses the mismatchingnumber of parentheses to insert 2 parentheses.\nNote that this may be removed or changed (hopefully improved) in the future as it is not the cleanest syntax.\n\nThis currently functions as below.\nHere, the call to `map()` is not closed, so two `)`s will be inserted after the block.\n\n```md\n::: {.stack arguments=\"dir: ltr, spacing:1fr, ..range(16).map(i=\u003erotate(24deg*i)\" spread=true}\nHi\n:::\n```\n\n### Linking (experimental)\n\nAnother feature is support for linking to arbitrary elements.\nIf `label=some-label` is set, then it can be linked using the Typst linking syntax.\nAssuming we have `highlight` listed under `functions:`, we could write:\n\n```md\n::: {.highlight label=block-highlight}\nLook at how yellow this gets.\n:::\n```\n\nThis is not currently a crossref in Quarto's sense.\nInstead, link with the following inline.\n\n```md\n`#link(\u003cblock-highlight\u003e)[like so]`{=typst}\n```\n\nThis feature is also experimental and only supported because I have a use case in mind.\nThis may be removed or changed in the future, likely to use Quarto-style crossrefs.\n\nYou can also use spans here, which is at least feels less ugly, though is still worse than crossreferences.\n\n```md\n[some linked text]{.link arguments=\u003cblock-highlight\u003e}\n```\n\nNote that a \"happy\" solution to linking/references is at the tradeoff of Quarto and Typst currenltly, as only floats or built in types can be crossreferenced in Quarto, whereas arbitrary elements can be linked in Typst.\n\n## Example\n\nA full example is available in [example.qmd](example.qmd).\n\n## Common issues\n\n```md\n:::{.align arguments = \"center\"}\nThis will not be processed because of the spaces after `arguments` and the `=` sign.\n:::\n\n:::{.align arguments=\"center\"}\nIt should look like this instead.\n:::\n```\n\n## License\n\nThis extension is licensed under the MIT license.\nThe extension builds from [(quarto-dev/latex-environment)](https://github.com/quarto-ext/latex-environment) which is licensed under MIT by Posit, PBC.\nAll modifications by me are licensed under the MIT license.\nSee the [license file](LICENSE) for futher details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherkenny%2Ftypst-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristopherkenny%2Ftypst-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristopherkenny%2Ftypst-function/lists"}