Test Gitea Runner functionality

This commit is contained in:
Warren
2026-05-30 14:08:55 +08:00
parent 596d8d5e27
commit b362e9b3f1
44 changed files with 1 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
use pulldown_cmark::{html, Options, Parser};
pub fn md_to_html(content: &str) -> String {
let mut opts = Options::empty();
opts.insert(Options::ENABLE_TABLES);
opts.insert(Options::ENABLE_FOOTNOTES);
opts.insert(Options::ENABLE_STRIKETHROUGH);
opts.insert(Options::ENABLE_TASKLISTS);
opts.insert(Options::ENABLE_HEADING_ATTRIBUTES);
let parser = Parser::new_ext(content, opts);
let mut body = String::new();
html::push_html(&mut body, parser);
body
}
const HTML: &str = include_str!("page.html");
pub fn page(title: &str, content: &str) -> String {
HTML.replace("{__TITLE__}", title)
.replace("{__CONTENT__}", content)
}
pub fn render_page(title: &str, content: &str) -> String {
let content = content
.replace(
"<code class=\"language-mermaid\">",
"<div class=\"mermaid\">",
)
.replace("</code>", "</div>");
page(title, &content).replace("startOnLoad:false", "startOnLoad:true")
}