Skip to content

Commit

Permalink
Move github markdown overrides into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Nov 14, 2024
1 parent 1315a57 commit a4bddd7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions apps/readme/assets/blitz-markdown-overrides.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.markdown-body {
max-width: 892px;
padding: 32px;
margin: 0 auto;
}
4 changes: 1 addition & 3 deletions apps/readme/assets/github-markdown-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
margin: 0;
color: #1f2328;
background-color: #ffffff;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
scroll-behavior: auto;
max-width: 892px;
padding: 32px;
margin: 0 auto;
}

.markdown-body .octicon {
Expand Down
5 changes: 3 additions & 2 deletions apps/readme/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use blitz_dom::net::Resource;
use blitz_dom::HtmlDocument;
use blitz_net::Provider;
use blitz_traits::net::SharedCallback;
use markdown::{markdown_to_html, MARKDOWN_STYLESHEET};
use markdown::{markdown_to_html, BLITZ_MD_STYLES, GITHUB_MD_STYLES};
use reqwest::header::HeaderName;

use dioxus_native::Callback;
Expand Down Expand Up @@ -33,7 +33,8 @@ fn main() {
let mut stylesheets = Vec::new();
if is_md {
html = markdown_to_html(html);
stylesheets.push(String::from(MARKDOWN_STYLESHEET));
stylesheets.push(String::from(GITHUB_MD_STYLES));
stylesheets.push(String::from(BLITZ_MD_STYLES));
}

// println!("{html}");
Expand Down
3 changes: 2 additions & 1 deletion apps/readme/src/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use comrak::{
RenderOptionsBuilder,
};

pub(crate) const MARKDOWN_STYLESHEET: &str = include_str!("../assets/github-markdown-light.css");
pub(crate) const GITHUB_MD_STYLES: &str = include_str!("../assets/github-markdown-light.css");
pub(crate) const BLITZ_MD_STYLES: &str = include_str!("../assets/blitz-markdown-overrides.css");

pub(crate) fn markdown_to_html(contents: String) -> String {
let plugins = Plugins::default();
Expand Down

0 comments on commit a4bddd7

Please sign in to comment.