Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/context/Page.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,33 @@ pub const Builtins = struct {
return String.init(aw.written());
}
};

pub const rawMarkdown = struct {
pub const signature: Signature = .{ .ret = .String };
pub const docs_description =
\\Renders the page's content to Markdown.
;
pub const examples = "";
pub fn call(
p: *const Page,
gpa: Allocator,
ctx: *const context.Template,
args: []const Value,
) context.CallError!Value {
if (args.len != 0) return .{ .err = "expected 0 arguments" };

var aw: Writer.Allocating = .init(gpa);
const ast = p._parse.ast;

render.markdown(
ctx,
p,
ast.md.root,
&aw.writer,
) catch return error.OutOfMemory;
return String.init(aw.written());
}
};
pub const contentSection = struct {
pub const signature: Signature = .{
.params = &.{.String},
Expand Down
1 change: 1 addition & 0 deletions src/render.zig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub const html = @import("render/html.zig").html;
pub const markdown = @import("render/markdown.zig").markdown;
pub const htmlToc = @import("render/html.zig").htmlToc;
pub const htmlTocDetails = @import("render/html.zig").htmlTocDetails;
Loading