author | Olivier Brunel
<jjk@jjacky.com> 2022-12-29 19:41:40 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2022-12-29 19:43:07 UTC |
parent | 14b08cc3267b047502edc555c4c59900a1960d31 |
base.htm | +24 | -24 |
common.css | +3 | -0 |
dark.css | +1 | -1 |
light.css | +2 | -2 |
main.c | +12 | -11 |
struct.css | +20 | -16 |
diff --git a/base.htm b/base.htm index e696d03..1128458 100644 --- a/base.htm +++ b/base.htm @@ -21,42 +21,42 @@ </section> <nav> <ul> - <li><a href="base.htm">Foobar Documentation</a></li> + <li><a href="base.htm">Foobar Documentation</a> <ul> - <li><a href="#welcome_to_foobar">Welcome to Foobar !</a></li> - <li><a href="#common_topics">Common Topics</a></li> + <li><a href="#welcome_to_foobar">Welcome to Foobar !</a> + <li><a href="#common_topics">Common Topics</a> <ul> - <li><a href="#getting_started">Getting Started</a></li> - <li><a href="#this_is_level_2">This is level 2</a></li> + <li><a href="#getting_started">Getting Started</a> + <li><a href="#this_is_level_2">This is level 2</a> <ul> - <li><a href="#this_is_level_3">This is level 3</a></li> + <li><a href="#this_is_level_3">This is level 3</a> <ul> - <li><a href="#this_is_level_4">This is level 4</a></li> + <li><a href="#this_is_level_4">This is level 4</a> <ul> - <li><a href="#this_is_level_5">This is level 5</a></li> + <li><a href="#this_is_level_5">This is level 5</a> <ul> - <li><a href="#this_is_level_6">This is level 6</a></li> + <li><a href="#this_is_level_6">This is level 6</a> </ul> </ul> </ul> </ul> </ul> - <li><a href="#citations_needed">Citations Needed</a></li> + <li><a href="#citations_needed">Citations Needed</a> <ul> - <li><a href="#lists">Lists...</a></li> + <li><a href="#lists">Lists...</a> </ul> - <li><a href="#highlights">Highlights</a></li> + <li><a href="#highlights">Highlights</a> <ul> - <li><a href="#code_blocks">Code Blocks</a></li> + <li><a href="#code_blocks">Code Blocks</a> </ul> <li><a href="#links">Links</a></li> - <li><a href="#user_inputs">User Inputs</a></li> + <li><a href="#user_inputs">User Inputs</a> <ul> - <li><a href="#keys">Keys</a></li> - <li><a href="#buttons">Buttons</a></li> - <li><a href="#mouse_buttons">Mouse buttons</a></li> + <li><a href="#keys">Keys</a> + <li><a href="#buttons">Buttons</a> + <li><a href="#mouse_buttons">Mouse buttons</a> </ul> - <li><a href="#boxes">Boxes</a></li> + <li><a href="#boxes">Boxes</a> </ul> </ul> </nav> @@ -105,7 +105,7 @@ Now we will have to test some very long line, to see how the overflow is handled </section> <section id="citations_needed"> <h1>Citations Needed</h1> - <p>Here's some <tt>typetext stuff</tt> after which will follow + <p>Here's some <code>typetext stuff</code> after which will follow no less than a quote : <blockquote cite="https://source.lnk"><p>Here it is. I'm a quote.<br>No really, I was said by someone, once.<br>I @@ -143,7 +143,7 @@ Now we will have to test some very long line, to see how the overflow is handled more <em>literally</em> than that.</p> <p>Anyays, here is the <span class="highlighted"><em>real</em> highlighted effect</span>. And let's make it work in - <tt>pre</tt>/<tt>code</tt> blocks too (unlike the others) : + <code>pre</code>/<code>code</code> blocks too (unlike the others) : <pre> This is a line. It continues here, @@ -155,9 +155,9 @@ multiple lines</span>. Yep. <section id="code_blocks"> <h2>Code Blocks</h2> <p>Oh yeah, we might wanna have "code blocks". Those would - be like <tt>pre</tt> ones, only a bit more styled : + be like <code>pre</code> ones, only a bit more styled : <pre class="lineno">1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10</pre> -<code>#include <stdlib.h> +<pre><code>#include <stdlib.h> int main(int argc, char **argv) { int nb = 3; @@ -166,8 +166,8 @@ int main(int argc, char **argv) printf("%d... ", i<span class="highlighted">, nb</span>); printf("Hello World!\n"); -}</code></p> - <p>Looking good? And yes, the <tt>highlighted</tt> effect +}</code></pre></p> + <p>Looking good? And yes, the <code>highlighted</code> effect works in there too.</p> </section> </section> diff --git a/common.css b/common.css index 7d0bd4e..7eb4671 100644 --- a/common.css +++ b/common.css @@ -5,6 +5,9 @@ main pre { margin: 1px 0 23px; padding: 12px; } +main pre code { + background: url(data:type/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAgCAYAAADT5RIaAAAAFklEQVQI12NgYGDgZWJgYGCgDkFtAAAWnAAsyj4TxgAAAABJRU5ErkJggg==) 0 0 repeat #f2ecb7; +} main blockquote :first-child::before { content: url(data:type/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAgCAYAAABU1PscAAABRElEQVRYw+3WTytEURjH8c/4l1JTpKxsyEbYWFkpG+UVKOWFeAts7eytbJSysLLVxIKNFAslwhSlUQabUdM0xm0e967Ot+7inPN8z+13z73nXBKJRCIRoJSxbggrmMMInlHBIWoF+KEAQ9jAaJuxe2zhJUe/Iz0ZahZ/uTmMYT1nPxxg/I/xWQzn6IcD1IIha//wkEIBKhlq+nP0wwHOsYuvDjWvOfod6c1Yd9O4ZjDQZvwAbzn6oRVofpKbqLf0P+GxAD8cAO7w0NJ3WqAfDlBCuan9gaMC/XCA+cbJ+sMRqgX6oQCTWGtqX2O/QL8tfRlqyljGUlPgW2y3+SDz8Lv6mRvEQmPbm25ZqQvs/LHtRf3wCkxgtaWvij2cZJg36ocD/Pw91nGJY5zhM+O8UT/8Ck01TswrvHcxb9RPJBKJRDF8AyNbWk4WFTIzAAAAAElFTkSuQmCC); float: left; diff --git a/dark.css b/dark.css index b716c35..6b63f98 100644 --- a/dark.css +++ b/dark.css @@ -24,7 +24,7 @@ header nav > ul > li > a { /* PAGE */ color: #55a5d9; } - header nav > ul > ul > li > a { /* h1 */ + header nav > ul > li > ul > li > a { /* h1 */ color: #a3a802; } main, main footer { diff --git a/light.css b/light.css index 9db05b2..e9e9bed 100644 --- a/light.css +++ b/light.css @@ -13,7 +13,7 @@ header section h2 { header nav { background: #343131; } -header nav ul li:hover { +header nav ul li a:hover { background: #4e4a4a; } header nav ul li a { @@ -22,7 +22,7 @@ header nav ul li a { header nav > ul > li > a { /* PAGE */ color: #55a5d9; } -header nav > ul > ul > li > a { /* h1 */ +header nav > ul > li > ul > li > a { /* h1 */ color: #a3a802; } main, main footer { diff --git a/main.c b/main.c index dcb0a06..524048d 100644 --- a/main.c +++ b/main.c @@ -337,7 +337,7 @@ enter_block(MD_BLOCKTYPE type, void *details, void *ctx_) || !escape_text(ctx, str_file(i), strlen(str_file(i))) || !raw_str(ctx, "\">") || !escape_text(ctx, str_title(i), strlen(str_title(i))) - || !raw_str(ctx, "</a></li>")) + || !raw_str(ctx, "</a>")) return ERR_PARSER_ENTER_BLOCK; /* remember positions for TOC */ @@ -525,7 +525,7 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) localtime_r(&ts.tv_sec, &tm); year[uint32_fmt(year, (uint32) 1900 + tm.tm_year)] = '\0'; if (((ctx->doc.flags & DOC_HAS_TITLE) && !raw_str(ctx, "</section>")) - || !raw_str(ctx, "<footer>Copyright © ") + || !raw_str(ctx, "</main><footer>Copyright © ") || !raw_str(ctx, year) || !raw_str(ctx, " ") || !escape_text(ctx, ctx->doc.author, strlen(ctx->doc.author)) @@ -596,7 +596,7 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) || !anchor(ctx, toc, l) || !raw_str(ctx, "\">") || !strip_tags(ctx, toc, l) - || !raw_str(ctx, "</a></li>")) + || !raw_str(ctx, "</a>")) return ERR_PARSER_TOC; ctx->doc.flags &= ~DOC_BUFFERING; } @@ -627,7 +627,8 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) if (!raw_str(ctx, buf) || !raw_str(ctx, "\n")) return ERR_PARSER_BUFFERED; } - if (!raw_str(ctx, "</pre><code>")) + if (!raw_str(ctx, "</pre>") || !raw_str(ctx, "<pre>") + || !raw_str(ctx, "<code>")) return ERR_PARSER_BUFFERED; } else { if (!raw_str(ctx, "<pre>")) @@ -641,11 +642,11 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) r = escape_text(ctx, buf, blen); if (!r) return ERR_PARSER_BUFFERED; - if (ctx->code.flags & CODE_LINES) - r = raw_str(ctx, "</code>"); - else - r = raw_str(ctx, "</pre>"); - if (!r) return ERR_PARSER_BUFFERED; + if ((ctx->code.flags & CODE_LINES) && !raw_str(ctx, "</code>")) + return ERR_PARSER_BUFFERED; + + if (!raw_str(ctx, "</pre>")) + return ERR_PARSER_BUFFERED; ctx->code.flags = 0; } @@ -709,7 +710,7 @@ enter_span(MD_SPANTYPE type, void *details, void *ctx_) break; case MD_SPAN_CODE: - if (!raw_str(ctx, "<tt>")) + if (!raw_str(ctx, "<code>")) return ERR_PARSER_ENTER_SPAN; break; @@ -758,7 +759,7 @@ leave_span(MD_SPANTYPE type, void *details, void *ctx_) break; case MD_SPAN_CODE: - if (!raw_str(ctx, "</tt>")) + if (!raw_str(ctx, "</code>")) return ERR_PARSER_LEAVE_SPAN; break; diff --git a/struct.css b/struct.css index a69ab2c..d486cfc 100644 --- a/struct.css +++ b/struct.css @@ -61,26 +61,26 @@ header nav > ul > li > a { /* PAGE */ font-weight: 600; text-transform: uppercase; } -header nav > ul > ul > li > a { /* h1 */ +header nav > ul > li > ul > li > a { /* h1 */ text-transform: uppercase; font-weight: 600; - margin-left: 12px; + padding-left: 12px; } -header nav > ul > ul > ul > li > a { /* h2 */ +header nav > ul > li > ul > li > ul > li > a { /* h2 */ font-weight: 400; - margin-left: 24px; + padding-left: 24px; } -header nav > ul > ul > ul > ul > li > a { /* h3 */ - margin-left: 36px; +header nav > ul > li > ul > li > ul > li > ul > li > a { /* h3 */ + padding-left: 36px; } -header nav > ul > ul > ul > ul > ul > li > a { /* h4 */ - margin-left: 48px; +header nav > ul > li > ul > li > ul > li > ul > li > ul > li > a { /* h4 */ + padding-left: 48px; } -header nav > ul > ul > ul > ul > ul > ul > li > a { /* h5 */ - margin-left: 60px; +header nav > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > a { /* h5 */ + padding-left: 60px; } -header nav > ul > ul > ul > ul > ul > ul > ul > li > a { /* h6 */ - margin-left: 72px; +header nav > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > ul > li > a { /* h6 */ + padding-left: 72px; } main { position: relative; @@ -104,11 +104,11 @@ main u { main s { text-decoration: line-through; } -main pre, main code, main tt, main kbd { +main pre, main code, main kbd { font-family: Monaco,Consolas,Liberation Mono,Courier,monospace; white-space: pre; } -main pre, main code { +main pre { line-height: 16px; overflow: auto; } @@ -121,11 +121,15 @@ main pre.lineno { float: left; overflow: hidden; } -main code { +main pre.lineno + pre { + padding: 0; + border: none; + background: none; +} +main pre code { display: block; padding: 0; margin: 12px 12px 0px 2px; - background: url(data:type/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAgCAYAAADT5RIaAAAAFklEQVQI12NgYGDgZWJgYGCgDkFtAAAWnAAsyj4TxgAAAABJRU5ErkJggg==) 0 0 repeat; overflow: hidden; } main h1 {