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

@ -108,7 +108,7 @@ impl ToHtml for Paragraph {
.elements
.iter()
.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
.iter()
.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 {
fn to_html(&self) -> String {
if let Some(description) = self.url.description.clone() {
format!(
"<div class='figure'>\
<a href={0}>\
<img src='{0}' alt='{1}'/>\
</a>\
<label class='imageDescription'>{1}</label>\
</div>",
self.url.url.clone(),
description
minify(
format!(
"<div class='figure'>\
<a href={0}>\
<img src='{0}' alt='{1}'/>\
</a>\
<label class='imageDescription'>{1}</label>\
</div>",
self.url.url.clone(),
description
)
.as_str(),
)
} else {
format!("<a href={0}><img src='{0}'/></a>", self.url.url.clone(),)

@ -595,7 +595,7 @@ impl Parser {
/// parses a markdown table
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;
self.seek_whitespace();
if self.check_special(&MINUS) {

Loading…
Cancel
Save