Browse Source
Apparently, the footnotes and superscript extensions conflicted with each other.master
15 changed files with 123 additions and 127 deletions
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
--- |
||||
title: Hello World |
||||
layout: false |
||||
draft: true |
||||
--- |
||||
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues). |
||||
|
||||
## Quick Start |
||||
|
||||
### Create a new post |
||||
|
||||
``` bash |
||||
$ hexo new "My New Post" |
||||
``` |
||||
|
||||
More info: [Writing](https://hexo.io/docs/writing.html) |
||||
|
||||
### Run server |
||||
|
||||
``` bash |
||||
$ hexo server |
||||
``` |
||||
|
||||
More info: [Server](https://hexo.io/docs/server.html) |
||||
|
||||
### Generate static files |
||||
|
||||
``` bash |
||||
$ hexo generate |
||||
``` |
||||
|
||||
More info: [Generating](https://hexo.io/docs/generating.html) |
||||
|
||||
### Deploy to remote sites |
||||
|
||||
``` bash |
||||
$ hexo deploy |
||||
``` |
||||
|
||||
More info: [Deployment](https://hexo.io/docs/one-command-deployment.html) |
@ -1,28 +1,33 @@
@@ -1,28 +1,33 @@
|
||||
use color_eyre::{Result, eyre::Context}; |
||||
use comrak::{ComrakOptions, Arena, parse_document, format_html, markdown_to_html}; |
||||
|
||||
use color_eyre::{eyre::Context, Result}; |
||||
use comrak::{format_html, nodes::AstNode, parse_document, Arena, ComrakOptions}; |
||||
|
||||
pub fn render(inp: &str) -> Result<String> { |
||||
let mut options = ComrakOptions::default(); |
||||
options.extension.autolink = true; |
||||
options.extension.table = true; |
||||
options.extension.description_lists = true; |
||||
options.extension.superscript = true; |
||||
options.extension.strikethrough = true; |
||||
options.extension.footnotes = true; |
||||
|
||||
options.render.unsafe_ = true; |
||||
|
||||
info!("{:?}", options.clone()); |
||||
info!("{:?}", inp.clone()); |
||||
let arena = Arena::new(); |
||||
let root = parse_document(&arena, inp, &options); |
||||
|
||||
Ok(markdown_to_html(inp, &options)) |
||||
/* |
||||
let mut html = vec![]; |
||||
format_html(root, &options, &mut html).unwrap(); |
||||
|
||||
info!("{:?}", String::from_utf8(html.clone())); |
||||
|
||||
String::from_utf8(html).wrap_err("this is somehow not UTF-8") |
||||
*/ |
||||
} |
||||
|
||||
/**
|
||||
* Takes in a root node and a function to act on it, then recursively acts on |
||||
* all children of that node |
||||
*/ |
||||
fn iter_nodes<'a, F>(node: &'a AstNode<'a>, f: &F) -> Result<()> |
||||
where |
||||
F: Fn(&'a AstNode<'a>) -> Result<()>, |
||||
{ |
||||
f(node)?; |
||||
for c in node.children() { |
||||
iter_nodes(c, f)?; |
||||
} |
||||
Ok(()) |
||||
} |
||||
|
@ -1,10 +1,9 @@
@@ -1,10 +1,9 @@
|
||||
pub mod handlers { |
||||
use color_eyre::Result; |
||||
use warp::{Reply, Rejection, http::Response}; |
||||
use crate::templates::{self, Html, RenderRucte}; |
||||
use color_eyre::Result; |
||||
use warp::{http::Response, Rejection, Reply}; |
||||
|
||||
pub async fn index() -> Result<impl Reply, Rejection> { |
||||
Response::builder() |
||||
.html(|o| templates::index_html(o)) |
||||
Response::builder().html(|o| templates::index_html(o)) |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue