aboutsummaryrefslogtreecommitdiff
path: root/src/typst.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/typst.zig')
-rw-r--r--src/typst.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/typst.zig b/src/typst.zig
new file mode 100644
index 0000000..9608af5
--- /dev/null
+++ b/src/typst.zig
@@ -0,0 +1,11 @@
+const std = @import("std");
+const typst = @cImport(@cInclude("typdown_typst.h"));
+
+pub fn generateSVG(alloc: std.mem.Allocator, content: []const u8) ![]const u8 {
+ const source = try alloc.dupeZ(u8, content);
+ defer alloc.free(source);
+ const raw_res = typst.typst_generateSVG(source);
+ const res = try alloc.dupe(u8, std.mem.span(raw_res));
+ defer typst.typst_freeString(raw_res);
+ return res;
+}