import typst
typst.__version__'0.15.0'

Table of Contents
Link to extension: https://extensions.blender.org/add-ons/typst-importer/
import sys
from pathlib import Path
from bl_ext.blender_org.typst_importer.notebook_utils import display_svg
from bl_ext.blender_org.typst_importer.typst_to_svg import typst_express
# The kernel runs inside Blender (not in the notebook folder), so add the docs helpers to sys.path
sys.path.append(str(Path.home() / "projects/bpy-gallery/docs/utils"))
from gallery_utils import fresh_scene, render_result



...1.85 -4.15 -3.75 -11.65 -5.2 -17.55c -3.65 -14.25 -7.05 -30....
c = typst_express("""
#set page(width: 550pt, height: auto, margin: 1cm, fill: none)
#import "@preview/codelst:2.0.2": sourcecode
#import "@preview/tablex:0.0.9": tablex
#let sourcecode = sourcecode.with(frame: (code) => block(
radius: 20pt,
stroke: 2pt + luma(0),
inset: 30pt,
text(size: 30pt, code)
))
#sourcecode[```python
for i in range(0,10):
print(i)
```]
""")
...485 1.0 L 31.25183317270539 1.0 L 32.477016489975924 1.0 L 3...
content = """
#set page(width: 800pt, height: auto, margin: 0cm, fill: none)
#import "@preview/codelst:2.0.2": sourcecode
#import "@preview/tablex:0.0.8": tablex
#let sourcecode = sourcecode.with(frame: (code) => block(
radius: 5pt,
stroke: 0pt + luma(0),
inset: 30pt,
text(size: 30pt, code)
))
#sourcecode[```python
class HelloWorld:
def __init__(self):
self.message = "Hello, world!"
def greet(self):
print(self.message)
if __name__ == "__main__":
hello = HelloWorld()
hello.greet()
```]
"""
c = typst_express(content)




def eq(equation: str, name: str, color: str, position=(0, 0, 0)):
typst_code = f"""
#set text({color})
$ {equation} $
"""
collection = typst_express(
typst_code,
origin_to_char=True,
convert_to_mesh=False,
name=name,
position=position
)
return collection
c1 = eq("a -b = c", "Start", "aqua", (0, -5, 0.5))
c2 = eq("a - 3 r_(beta) = c", "End", "olive", (0, -4, 0));

# General quadratic equation
c1 = typst_express("$ x^2 + p x + q = 0 $", origin_to_char=True, position=(0, 0, 10), name="Step1")
# Step 1: Complete the square
c2 = typst_express("$ x^2 + p x = -q $", origin_to_char=True, position=(0, -1.5, 9), name="Step2")
# Step 2: Add and subtract (p/2)^2 on the left side
c3 = typst_express("$ x^2 + p x + (p/2)^2 = -q + (p/2)^2 $", origin_to_char=True, position=(0, -3, 8), name="Step3")
# Step 3: Rewrite as squared binomial
c4 = typst_express("$ (x + p/2)^2 = (p/2)^2 - q $", origin_to_char=True, position=(0, -4.5, 7), name="Step4")
# Step 4: Square root both sides
c5 = typst_express("$ x + p/2 = plus.minus sqrt((p/2)^2 - q) $", origin_to_char=True, position=(0, -6, 6), name="Step5")
# Step 5: Solve explicitly for x
c6 = typst_express("$ x_(1,2) = -p/2 plus.minus sqrt((p/2)^2 - q) $", origin_to_char=True, position=(0, -7.5, 5), name="Step6")
# Render all steps

03:19.968 blend.writefile | WARNING Found an ID 'METorus.003' flagged as copy/paste clipboard data while writing a regular blendfile, clearing the flag