diff --git a/public/css/css.css b/public/css/css.css index 1df79ae..f6cfaab 100644 --- a/public/css/css.css +++ b/public/css/css.css @@ -133,7 +133,7 @@ body { text-align: center; } -@media (max-width:600px) { +@media (max-width:800px) { #content { grid-template-areas: "header1" diff --git a/public/index.html b/public/index.html index 944601a..8baca06 100644 --- a/public/index.html +++ b/public/index.html @@ -4,6 +4,11 @@ + @@ -38,13 +43,13 @@ Footer
diff --git a/public/js/code_highlighter.js b/public/js/code_highlighter.js index f04ab02..b959812 100644 --- a/public/js/code_highlighter.js +++ b/public/js/code_highlighter.js @@ -148,4 +148,50 @@ const maps = { ], }, + rust: { + rules: [ + comment("//"), + + string("\""), + // single char + (peek, take) => { + if (peek(0) == "'") { + let b = peek(1); + take(3); + return `'${b}'`; + } + }, + + keyword("fn"), + keyword("struct"), + keyword("enum"), + keyword("trait"), + + keyword("Option"), + keyword("Some"), + keyword("None"), + keyword("Result"), + keyword("Ok"), + keyword("Err"), + keyword("in"), + + altKeyword("if"), + altKeyword("else"), + altKeyword("match"), + altKeyword("loop"), + altKeyword("for"), + altKeyword("while"), + + altKeyword("mod"), + altKeyword("use"), + altKeyword("pub"), + altKeyword("impl"), + altKeyword("crate"), + altKeyword("let"), + altKeyword("const"), + altKeyword("static"), + + ] + } + }; diff --git a/public/posts/_test.md b/public/posts/_test.md index 69c55d3..46cbf99 100644 --- a/public/posts/_test.md +++ b/public/posts/_test.md @@ -62,6 +62,32 @@ in } ``` +```rust +// Rust code block +fn main() { + let x = 40.3; + let y = x; + + let g = G { s: vec!["this", "is", "a", "test"] }; +} + +struct G { + pub s: Vec +} + +pub trait T { + fn some_fn() -> Result<(), String>; +} + +impl T for G { + fn some_fn() -> Result<(), String> { + Ok(()) + } +} +``` + +struct + - List - Test - here