use mlua::IntoLua;
use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct MdBlock {
pub lang: Option<String>,
pub content: String,
}
impl MdBlock {
#[allow(unused)]
pub fn new(lang: Option<String>, content: impl Into<String>) -> Self {
MdBlock {
lang,
content: content.into(),
}
}
}
impl IntoLua for MdBlock {
fn into_lua(self, lua: &mlua::Lua) -> mlua::Result<mlua::Value> {
let table = lua.create_table()?;
table.set("lang", self.lang)?;
table.set("content", self.content)?;
Ok(mlua::Value::Table(table))
}
}