Remove minifcation of parentheses to avoid loosing spaces

- Improve table style
pull/1/head
trivernis 4 years ago
parent fbb33ea6d9
commit 4e1e4fa5ae

@ -1,11 +1,12 @@
body { body {
background-color: #DDD; background-color: #DDD;
overflow-x: hidden;
} }
.content { .content {
font-family: "Noto Sans", SansSerif, sans-serif; font-family: "Noto Sans", SansSerif, sans-serif;
width: 100vh; width: 100vh;
max-width: 100%; max-width: calc(100% - 4rem);
padding: 2rem; padding: 2rem;
margin: auto; margin: auto;
background-color: #FFF; background-color: #FFF;
@ -25,6 +26,22 @@ code pre {
border-radius: 0.25em; border-radius: 0.25em;
} }
code {
font-family: "Fira Code", monospace;
padding: 0 0.1em;
background-color: #DDD;
border-radius: 0.1em;
}
.tableWrapper {
overflow-x: auto;
width: 100%;
}
.tableWrapper > table {
margin: auto;
}
table { table {
border-collapse: collapse; border-collapse: collapse;
} }
@ -41,7 +58,7 @@ table tr:nth-child(1) {
table td, table th { table td, table th {
border-left: 1px solid black; border-left: 1px solid black;
padding: 0.2em padding: 0.2em 0.5em
} }
table tr td:first-child, table tr th:first-child { table tr td:first-child, table tr th:first-child {
@ -52,6 +69,8 @@ blockquote {
margin-left: 0 margin-left: 0
} }
p p, p a, p b,
.quote { .quote {
border-left: 0.3em solid gray; border-left: 0.3em solid gray;
border-radius: 0.2em; border-radius: 0.2em;

@ -108,7 +108,7 @@ impl ToHtml for Paragraph {
.elements .elements
.iter() .iter()
.fold("".to_string(), |a, b| combine_with_lb!(a, b)); .fold("".to_string(), |a, b| combine_with_lb!(a, b));
minify(format!("<p>{}</p>", inner).as_str()) format!("<p>{}</p>", inner)
} }
} }
@ -153,7 +153,10 @@ impl ToHtml for Table {
.rows .rows
.iter() .iter()
.fold("".to_string(), |a, b| format!("{}{}", a, b.to_html())); .fold("".to_string(), |a, b| format!("{}{}", a, b.to_html()));
format!("<table><tr>{}<tr>{}</table>", head, body) format!(
"<div class='tableWrapper'><table><tr>{}<tr>{}</table></div>",
head, body
)
} }
} }
@ -217,15 +220,18 @@ impl ToHtml for Text {
impl ToHtml for Image { impl ToHtml for Image {
fn to_html(&self) -> String { fn to_html(&self) -> String {
if let Some(description) = self.url.description.clone() { if let Some(description) = self.url.description.clone() {
format!( minify(
"<div class='figure'>\ format!(
<a href={0}>\ "<div class='figure'>\
<img src='{0}' alt='{1}'/>\ <a href={0}>\
</a>\ <img src='{0}' alt='{1}'/>\
<label class='imageDescription'>{1}</label>\ </a>\
</div>", <label class='imageDescription'>{1}</label>\
self.url.url.clone(), </div>",
description self.url.url.clone(),
description
)
.as_str(),
) )
} else { } else {
format!("<a href={0}><img src='{0}'/></a>", self.url.url.clone(),) format!("<a href={0}><img src='{0}'/></a>", self.url.url.clone(),)

@ -595,7 +595,7 @@ impl Parser {
/// parses a markdown table /// parses a markdown table
fn parse_table(&mut self) -> Result<Table, ParseError> { fn parse_table(&mut self) -> Result<Table, ParseError> {
let header = self.parse_row()?; let header = self.parse_row()?; // TODO: Fix this row not being included
let start_index = self.index; let start_index = self.index;
self.seek_whitespace(); self.seek_whitespace();
if self.check_special(&MINUS) { if self.check_special(&MINUS) {

Loading…
Cancel
Save