/markdown-compiler

A tiny rust markdown to html compiler for my blog

Primary LanguageRustMIT LicenseMIT

Markdown Compiler Library

Purpose

Just translates markdown to html, probably the markdown implementation will differ from the original in the future, some features will be missing and others would be new.

The only purpose of this library is to let me write blog entries easily
Blog Repo: repo
Blog Website: cdecompilador blog

Demo example

use std::io::{self, Read};

/// Usage `cargo r --example demo < ./examples/input.txt`
fn main() -> io::Result<()> {
    // Read the markdown from the stdin
    let mut source = String::new(); 
    std::io::stdin().read_to_string(&mut source)?;

    // Compile it!
    let resulting_html = compile_markdown(&source);

    // Write it to `./result.html`
    std::fs::write("result.html", resulting_html)?;

    Ok(())
}

Objectives

✅ Parse Headers
✅ Parse raw text
✅ Parse Code snippets
❌ Syntax highlighting
❌ Parse bold and italic text
❌ Add links support
❌ Remove unnecessary code (DoubleEndedItearator not used)
❌ Fix that tab hell in the parser
❌ A lot more...