[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108229":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":15,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":33,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":16,"starSnapshotCount":16,"syncStatus":13,"lastSyncTime":37,"discoverSource":38},108229,"untie","caelyreth\u002Funtie","caelyreth","Pure-Go TeX and Typst math renderer for native UIs and MyGo","https:\u002F\u002Funtie.iki.moe",null,"Go",67,2,53,1,0,3,13,4,46.23,"Apache License 2.0",false,"main",[25,26,27,28,29,30,31,32],"golang","golang-library","latex","math","math-library","mygo","renderer","typst","2026-11-22 09:23:04","2026-11-23 08:30:00","## Untie\n\nUntie is a pure-Go math renderer for TeX and Typst. It parses both input\nlanguages into one language-neutral representation, lays formulas out with a\nhost-supplied OpenType MATH font, and returns a UI-independent display list of\nglyph paths, rules, source hits, and accessibility text.\n\n### Properties\n\n- one renderer for TeX and Typst math;\n- pure Go with `CGO_ENABLED=0`;\n- no browser, DOM, GPU, platform text, or system-font dependency;\n- deterministic layout and output;\n- recoverable parsing with source diagnostics;\n- core color policies for authored-color preservation, semantic mapping, and\n  contrast correction;\n- structured text-face and missing-fallback reporting;\n- optional conservative pixel-grid snapping for thin rules and stems;\n- source-mapped hit regions, caret stops, and explicit stable node IDs;\n- OpenType MATH metrics, glyph outlines, variants, and assemblies;\n- reusable rendering with bounded caches;\n- inline and display layout, line breaking, equation tags, and overflow bounds;\n- formula-scoped labels and host-resolved equation references;\n- deterministic text, speech, and structured localization alternatives for\n  accessibility;\n- deterministic Presentation MathML export and a bounded strict importer;\n- bounded `mhchem`-style `\\ce` and `\\pu` support without a chemistry database;\n- coalesced streaming layouts with stable display-list transitions;\n- optional SVG and PNG output.\n\n### Use\n\n`NewRenderer` is the main API for applications. Load the font once, keep the\nrenderer, and call `Render` whenever the source or style changes.\n\n```go\nimport (\n\t\"context\"\n\t\"os\"\n\n\t\"github.com\u002Fcaelyreth\u002Funtie\"\n\t\"github.com\u002Fcaelyreth\u002Funtie\u002Frender\"\n)\n\nfontBytes, err := os.ReadFile(\"NewCMMath-Book.otf\")\nif err != nil {\n\treturn err\n}\nfonts, err := untie.LoadMathFont(fontBytes)\nif err != nil {\n\treturn err\n}\nmath, err := untie.NewRenderer(fonts, untie.RendererOptions{\n\tDefaultStyle: untie.Style{Size: 24},\n\tCacheEntries: 128,\n})\nif err != nil {\n\treturn err\n}\n\nresult, err := math.Render(context.Background(), `x^2+\\frac{1}{2}`, untie.RenderRequest{\n\tMode: untie.Display,\n})\nif err != nil {\n\t\u002F\u002F Recoverable parse diagnostics may still be present in result.\n\treturn err\n}\n\nerr = render.Walk(result.Box, func(command render.Command) error {\n\tswitch command.Kind {\n\tcase render.CommandPath:\n\t\t\u002F\u002F Paint command.Path using command.At, command.Em, and command.Paint.\n\tcase render.CommandRule:\n\t\t\u002F\u002F Fill command.Rect with command.Paint.\n\t}\n\treturn nil\n})\n```\n\nThe renderer caches immutable parsed expressions when `CacheEntries` is\npositive. It never reuses returned boxes, so each successful `Render` produces\nan independent display list.\n\nFor ready-made output, use\n[`encode\u002Fsvg`](encode\u002Fsvg\u002Fdoc.go) or [`encode\u002Fraster`](encode\u002Fraster\u002Fdoc.go).\nSVG supports deterministic vector export; the raster package provides\nantialiased RGBA and PNG output without cgo.\n\nUse [`mathml`](mathml\u002Fmathml.go) for Presentation MathML interchange. Export\ncovers every canonical IR node family. Import is intentionally limited to a\ndocumented strict subset with structured diagnostics for unsupported input.\n\n### Lower-Level API\n\nUse `NewEngine` when you need explicit engine ownership, direct canonical-IR\nlayout, or a custom parse\u002Flayout pipeline. It exposes the same layout core as\n`Renderer`, without the convenience facade.\n\n```go\nengine, err := untie.NewEngine(fonts, untie.Limits{})\nif err != nil {\n\treturn err\n}\nexpr := untie.ParseTeX(`\\sum_{i=1}^{n} i^2`, untie.Display, untie.ParseOptions{})\nbox, err := engine.Layout(expr, untie.Style{Size: 24})\n```\n\nSee [Getting Started](docs\u002Fgetting-started.md) for the complete\nintegration pipeline and [Rendering](docs\u002Frendering.md) for the\ndrawing contract.\n\n### MyGo\n\nThe optional [`contrib\u002Fmygo`](contrib\u002Fmygo) adapter renders directly to MyGo\nelements and plugs into Markdown math:\n\n```go\nmath, err := untiemygo.New(fonts, untiemygo.Options{\n\tDialect:      untie.TeX,\n\tCacheEntries: 128,\n})\nif err != nil {\n\treturn err\n}\n\nui.Column(c).Children(func() {\n\tmath.Element(c, source, untie.Display).FillWidth()\n})\n```\n\n`BindMarkdown` adds `$...$`, `$$...$$`, `\\(...\\)`, and `\\[...\\]` support to a\nMyGo Markdown view. See the\n[MyGo integration guide](docs\u002Fmygo.md) for direct elements,\nMarkdown binding, and existing-box drawing.\n\n### Documentation\n\n- [Runnable Examples](examples\u002FREADME.md)\n- [Website and Documentation Project](web\u002FREADME.md)\n- [Getting Started](docs\u002Fgetting-started.md)\n- [Core Concepts](docs\u002Fconcepts.md)\n- [Rendering](docs\u002Frendering.md)\n- [Streaming](docs\u002Fstreaming.md)\n- [MathML Interchange](docs\u002Fmathml.md)\n- [Editor Integration](docs\u002Feditor-integration.md)\n- [Fonts](docs\u002Ffonts.md)\n- [Parsing](docs\u002Fparsing.md)\n- [MyGo Integration](docs\u002Fmygo.md)\n- [Supported TeX](docs\u002Ftex-support.md)\n- [TeX Chemistry](docs\u002Fchemistry.md)\n- [Supported Typst](docs\u002Ftypst-support.md)\n- [API Stability](docs\u002Fstability.md)\n- [Migrating to 0.3](docs\u002Fmigration-v0.3.md)\n- [Migrating to 0.4](docs\u002Fmigration-v0.4.md)\n- [Migrating to 0.5](docs\u002Fmigration-v0.5.md)\n- [Release Process](docs\u002Freleasing.md)\n- [Security Policy](SECURITY.md)\n- [Full Documentation Index](docs\u002FREADME.md)\n\n### Release\n\n`v0.5.0` is the latest published release.\nUntie remains pre-1.0 while its API stability tiers are validated through real\nintegrations. Release notes are generated from Conventional Commits and\npublished in [GitHub Releases](https:\u002F\u002Fgithub.com\u002Fcaelyreth\u002Funtie\u002Freleases);\nsee [Release Process](docs\u002Freleasing.md) for the maintainer workflow.\n\n### License\n\nCopyright 2026 Yu (Caelyreth).\n\nUntie is dual-licensed under either:\n\n- the [MIT License](LICENSE-MIT);\n- the [Apache License, Version 2.0](LICENSE-APACHE).\n\nYou may choose either license at your option.\n\nThe SPDX expression for original project material is `MIT OR Apache-2.0`.\n\nThird-party material remains under its own license; see\n[Third-Party Licenses](licenses\u002FREADME.md).\n","Untie 是一个纯 Go 编写的数学公式渲染器，支持 TeX 和 Typst 两种数学标记语法。它将输入解析为统一的中间表示，基于 OpenType MATH 字体进行确定性排版，输出与 UI 框架无关的矢量路径、规则、可访问性文本及源码映射区域。项目不依赖 CGO、系统字体、浏览器或 GPU，具备可恢复解析、结构化错误诊断、色彩策略、行内\u002F块级布局、方程标签与引用、MathML 导出及 SVG\u002FPNG 编码等能力，适用于嵌入式 UI、本地化富文本编辑器、学术笔记工具及 MyGo 等原生 Go 应用中的数学内容渲染。","2026-11-24 04:33:56","CREATED_QUERY"]