fix: flatten content and then apply markup rules
This commit is contained in:
@ -3,13 +3,29 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 35em;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-family: "Times New Roman", Times, serif;
|
||||
font-family: sohne, "Helvetica Neue", Helvetica, Arial, sans-serif !important;
|
||||
}
|
||||
|
||||
a {
|
||||
@ -27,24 +43,10 @@ a:hover {
|
||||
|
||||
html {
|
||||
color: #333;
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
font-family: charter, Georgia, Cambria, "Times New Roman", Times, serif;
|
||||
font-size: 26px;
|
||||
line-height: 1.55rem;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 35em;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 20px 0;
|
||||
}
|
||||
@ -72,19 +74,19 @@ code {
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
pre {
|
||||
font-family: monospace;
|
||||
font-family: Menlo, Monaco, "Courier New", Courier, monospace;
|
||||
font-size: 15px;
|
||||
white-space: pre-wrap;
|
||||
/*
|
||||
font-weight: 600;
|
||||
*/
|
||||
line-height: 1rem;
|
||||
padding: 5px;
|
||||
padding: 20px;
|
||||
border-radius: 6px;
|
||||
background-color: rgba(175, 184, 193, 0.2);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
.code-block {
|
||||
display: block;
|
||||
|
@ -23,63 +23,8 @@
|
||||
|
||||
</p>
|
||||
<article>
|
||||
<. let paragraphs = &data.content.body_model.paragraphs; .>
|
||||
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
|
||||
<. if open_list && p.type_ != "OLI" { .>
|
||||
</ol>
|
||||
<. } .>
|
||||
<. if pindex == 0 && p.type_ == "H3" {.>
|
||||
<. continue; .>
|
||||
<.}.>
|
||||
<. if p.type_ == "IMG" {.>
|
||||
<. include!("./img.html"); .>
|
||||
<.} else if p.type_ == "P" {.>
|
||||
<p><. include!("./_markup.html"); .></p>
|
||||
<.} else if p.type_ == "BQ" {.>
|
||||
<blockquote><. include!("./_markup.html"); .></blockquote>
|
||||
<.} else if p.type_ == "H2" {.>
|
||||
<h2><.= p.text .></h2>
|
||||
<.} else if p.type_ == "H3" {.>
|
||||
<h3><.= p.text .></h3>
|
||||
<.} else if p.type_ == "H4" {.>
|
||||
<h4><.= p.text .></h4>
|
||||
<.} else if p.type_ == "H5" {.>
|
||||
<h5><.= p.text .></h5>
|
||||
<.} else if p.type_ == "H6" {.>
|
||||
<h6><.= p.text .></h6>
|
||||
<.} else if p.type_ == "IFRAME" {.>
|
||||
<. let src = &p.iframe.as_ref().unwrap().media_resource.as_ref().unwrap().href; .>
|
||||
<. if src.contains("gist.github.com"){.>
|
||||
<. include!("./gist_insert.html"); .>
|
||||
<!--
|
||||
<iframe src="<.#= crate::V1_API_ROUTES.proxy.get_gist(&src) .>" frameborder="0"></iframe>
|
||||
<a href="<.= src .>">Click here to open gist on GitHub</a>
|
||||
-->
|
||||
<.} else {.>
|
||||
<iframe src="<.= src .>" frameborder="0"></iframe>
|
||||
<.}.>
|
||||
<.} else if p.type_ == "OLI" {.>
|
||||
<. if !open_list { .>
|
||||
<. open_list = true;.>
|
||||
<ol>
|
||||
<. } .>
|
||||
<li><.= p.text .></li>
|
||||
<.} else {.>
|
||||
<p>
|
||||
<. include!("./_markup.html"); .>
|
||||
</p>
|
||||
<p class="libmedium__meta">
|
||||
<b>From LibMedium:</b> LibMedium is built by reverse
|
||||
engineering the Meduim's internal API. This post contains
|
||||
markup(formatting rules) that we are unaware of.
|
||||
Please report this URL <a
|
||||
href="https://github.com/realaravinth/libmedium/issues/1"
|
||||
rel="noreferrer">on our bug tracker</a> so that we can
|
||||
improve page rendering.
|
||||
<br />
|
||||
Alternatively, you can also email me at realaravinth at batsense dot net!
|
||||
</p>
|
||||
<.}.>
|
||||
<. for (_pindex, p) in paragraphs.iter().enumerate() {.>
|
||||
<.- p .>
|
||||
<.}.>
|
||||
</article>
|
||||
</main>
|
||||
|
Reference in New Issue
Block a user