Skip to content

Commit f31e7ef

Browse files
committed
fix: better margins for tables and pre blocks
1 parent 6726412 commit f31e7ef

File tree

3 files changed

+40
-27
lines changed

3 files changed

+40
-27
lines changed

otterwiki/static/css/elements/page.css

+4-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@
8383
.page table {
8484
background-color: rgba(0, 0, 0, 0.1);
8585
border-collapse: collapse;
86-
margin-bottom: 2rem;
86+
margin-block-start: 1rem;
87+
margin-block-end: 1rem;
8788
}
89+
8890
.page th {
8991
background-color: rgba(0, 0, 0, 0.2);
9092
text-align:center;
@@ -113,4 +115,4 @@
113115
.page table > :last-child > tr:last-child > td,
114116
.page table > :last-child > tr:last-child > th {
115117
border-bottom: 0;
116-
}
118+
}

otterwiki/static/css/otterwiki.css

+12-1
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,21 @@ h5:hover a.anchor {
5858
display: none;
5959
}
6060

61+
.block-compact {
62+
margin-block-start: 0rem !important;
63+
margin-block-end: 0rem !important;
64+
}
65+
6166
/* pre and code */
6267

6368
div.page > div.highlight {
64-
margin-bottom: 1rem;
69+
margin-block-start: 1rem;
70+
margin-block-end: 1rem;
71+
}
72+
73+
.page pre {
74+
margin-block-start: 1rem;
75+
margin-block-end: 1rem;
6576
}
6677

6778
code,

otterwiki/templates/snippets/syntax.html

+24-24
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h4>{{ name }}</h4>
1010
{{ heading("Emphasis") }}
1111
<div class="row mb-10">
1212
<div class="col-md-6 col-sm-12">
13-
<pre>**<strong>bold</strong>**
13+
<pre class="block-compact">**<strong>bold</strong>**
1414
*<em>italics</em>*
1515
~~<strike>strikethrough</strike>~~
1616
==<mark>mark</mark>==
@@ -26,7 +26,7 @@ <h4>{{ name }}</h4>
2626
You can use backslash escapes to generate literal characters that are used for formatting otherwise, e.g.
2727
<div class="row">
2828
<div class="col-md-6 col-sm-12">
29-
<pre>
29+
<pre class="block-compact">
3030
\*literal asterisks\*
3131
</pre>
3232
</div>
@@ -57,7 +57,7 @@ <h4>{{ name }}</h4>
5757
{{ heading("Lists") }}
5858
<div class="row">
5959
<div class="col-md-6 col-sm-12">
60-
<pre>- Generic list item
60+
<pre class="block-compact">- Generic list item
6161
- Generic list item
6262
- Generic list item</pre>
6363
</div>
@@ -72,7 +72,7 @@ <h4>{{ name }}</h4>
7272
<br/>
7373
<div class="row">
7474
<div class="col-md-6 col-sm-12">
75-
<pre>1. Numbered list item
75+
<pre class="block-compact">1. Numbered list item
7676
2. Numbered list item
7777
3. Numbered list item</pre>
7878
</div>
@@ -88,7 +88,7 @@ <h4>{{ name }}</h4>
8888
{{ heading("Links") }}
8989
<div class="row">
9090
<div class="col-md-6 col-sm-12">
91-
<pre class="text-wrap">[[WikiPage]]</pre>
91+
<pre class="block-compact text-wrap">[[WikiPage]]</pre>
9292
</div>
9393
<div class="col-md-6 col-sm-12 pl-5">
9494
<a href="#">WikiPage</a>
@@ -97,7 +97,7 @@ <h4>{{ name }}</h4>
9797

9898
<div class="row">
9999
<div class="col-md-6 col-sm-12">
100-
<pre class="text-wrap">[[Text to display|WikiPage]]</pre>
100+
<pre class="block-compact text-wrap">[[Text to display|WikiPage]]</pre>
101101
</div>
102102
<div class="col-md-6 col-sm-12 pl-5">
103103
<a href="#">Text to display</a>
@@ -106,7 +106,7 @@ <h4>{{ name }}</h4>
106106

107107
<div class="row">
108108
<div class="col-md-6 col-sm-12">
109-
<pre class="text-wrap">http://www.example.com</pre>
109+
<pre class="block-compact text-wrap">http://www.example.com</pre>
110110
</div>
111111
<div class="col-md-6 col-sm-12 pl-5">
112112
<a href="#">http://example.com</a>
@@ -115,7 +115,7 @@ <h4>{{ name }}</h4>
115115

116116
<div class="row">
117117
<div class="col-md-6 col-sm-12">
118-
<pre class="text-wrap">[Link with text](http://example.com)</pre>
118+
<pre class="block-compact text-wrap">[Link with text](http://example.com)</pre>
119119
</div>
120120
<div class="col-md-6 col-sm-12 pl-5">
121121
<a href="#">Link with text</a>
@@ -125,7 +125,7 @@ <h4>{{ name }}</h4>
125125
{{ heading("Quotes") }}
126126
<div class="row">
127127
<div class="col-md-6 col-sm-12 p-5">
128-
<pre>&gt; This is a quote.
128+
<pre class="block-compact">&gt; This is a quote.
129129
&gt; It can span multiple lines!
130130
&gt;&gt; And multiple levels.
131131
&gt;&gt; *<em>With markdown syntax.</em>*</pre>
@@ -142,14 +142,14 @@ <h4>{{ name }}</h4>
142142

143143
{{ heading("Images") }}
144144
<p>You can copy n paste images directly into the editor, they will be uploaded as attachments.</p>
145-
<pre>![](http://www.example.com/image.jpg)</pre>
145+
<pre class="block-compact">![](http://www.example.com/image.jpg)</pre>
146146
<p>Check the attachments of a page, there are links for copy'n'paste.</p>
147147

148148
{{ heading("Tables") }}
149149

150150
<div class="row">
151151
<div class="col-md-6 col-sm-12 p-5">
152-
<pre>| Column 1 | Column 2 | Column 3 |
152+
<pre class="block-compact">| Column 1 | Column 2 | Column 3 |
153153
| -------- | -------- | -------- |
154154
| John | Doe | Peach |
155155
| Mary | Smith | Banana |</pre>
@@ -182,7 +182,7 @@ <h4>{{ name }}</h4>
182182

183183
<div class="row">
184184
<div class="col-md-6 col-sm-12 p-5">
185-
<pre class="text-wrap">Inline code `int n = 1` with backticks.</pre></div>
185+
<pre class="block-compact text-wrap">Inline code `int n = 1` with backticks.</pre></div>
186186
<div class="col-md-6 col-sm-12 p-5">
187187
Inline code <code>int n = 1</code> with backticks.
188188
</div>
@@ -200,13 +200,13 @@ <h4>{{ name }}</h4>
200200

201201
<div class="row">
202202
<div class="col-md-6 col-sm-12 p-5">
203-
<pre>```python
203+
<pre class="block-compact">```python
204204
#!/usr/bin/env python
205205
assert 1 + 1 == 2
206206
print("Hello World!")```</pre>
207207
</div>
208208
<div class="col-md-6 col-sm-12 p-5">
209-
<div class="highlight"><pre><span></span><span class=".highlight ch">#!/usr/bin/env python</span>
209+
<div class="highlight"><pre class="block-compact"><span></span><span class=".highlight ch">#!/usr/bin/env python</span>
210210
<span class=".highlight k">assert</span> <span class=".highlight mi">1</span> <span class=".highlight o">+</span> <span class=".highlight mi">1</span> <span class=".highlight o">==</span> <span class=".highlight mi">2</span>
211211
<span class=".highlight nb">print</span><span class=".highlight p">(</span><span class=".highlight s2">&quot;Hello World!&quot;</span><span class=".highlight p">)</span>
212212
</pre></div>
@@ -217,15 +217,15 @@ <h4>{{ name }}</h4>
217217

218218
<div class="row">
219219
<div class="col-md-6 col-sm-12 p-5">
220-
<pre class="text-wrap">Inline math: `$a^2+b^2=c^2$`</pre></div>
220+
<pre class="block-compact text-wrap">Inline math: `$a^2+b^2=c^2$`</pre></div>
221221
<div class="col-md-6 col-sm-12 p-5">
222222
Inline Math: \(a^2+b^2=c^2\)
223223
</div>
224224
</div>
225225

226226
<div class="row">
227227
<div class="col-md-6 col-sm-12 p-5">
228-
<pre>
228+
<pre class="block-compact">
229229
Math block:
230230
```math
231231
a^2+b^2=c^2
@@ -242,7 +242,7 @@ <h4>{{ name }}</h4>
242242

243243
<div class="row">
244244
<div class="col-md-6 col-sm-12 p-5">
245-
<pre>
245+
<pre class="block-compact">
246246
Inline Math: $a^2+b^2=c^2$
247247
</pre>
248248
</div>
@@ -252,7 +252,7 @@ <h4>{{ name }}</h4>
252252
</div>
253253
<div class="row">
254254
<div class="col-md-6 col-sm-12 p-5">
255-
<pre>
255+
<pre class="block-compact">
256256
Equation:
257257
$$a^2+b^2=c^2$$
258258
</pre>
@@ -266,7 +266,7 @@ <h4>{{ name }}</h4>
266266

267267
<div class="row">
268268
<div class="col-md-6 col-sm-12 p-5">
269-
<pre>
269+
<pre class="block-compact">
270270
Footnote identifiers[^1] are single characters
271271
or words[^bignote]. And can be referenced
272272
multiple[^1] times.
@@ -305,7 +305,7 @@ <h4>{{ name }}</h4>
305305
<h4>Fancy blocks</h4>
306306
<div class="row">
307307
<div class="col-md-6 col-sm-12 p-5">
308-
<pre>
308+
<pre class="block-compact">
309309
::: info
310310
# Head of the block.
311311
With _formatted_ content.
@@ -322,7 +322,7 @@ <h4>Fancy blocks</h4>
322322
<h4>Spoiler blocks</h4>
323323
<div class="row my-20">
324324
<div class="col-md-6 col-sm-12">
325-
<pre>
325+
<pre class="block-compact">
326326
&gt;! Spoiler blocks reveal their
327327
&gt;! content on click on the icon.
328328
</pre>
@@ -337,7 +337,7 @@ <h4>Spoiler blocks</h4>
337337
<h4>Folded blocks</h4>
338338
<div class="row my-20 h-100">
339339
<div class="col-md-6 col-sm-12">
340-
<pre>
340+
<pre class="block-compact">
341341
&gt;| # Headline is used as summary
342342
&gt;| with the details folded.
343343
</pre>
@@ -354,7 +354,7 @@ <h4>Folded blocks</h4>
354354
<h4>Alerts</h4>
355355
<div class="row">
356356
<div class="col-md-6 col-sm-12 p-5">
357-
<pre>
357+
<pre class="block-compact">
358358
> [!NOTE]
359359
> Useful for highlighting special
360360
> information in your code.
@@ -371,7 +371,7 @@ <h4>Alerts</h4>
371371
Using <a href="https://mermaid.js.org/">Mermaid</a> you can create diagrams and visualizations in your wiki pages.
372372
<div class="row">
373373
<div class="col-md-6 col-sm-12 p-5">
374-
<pre>
374+
<pre class="block-compact">
375375
```mermaid
376376
flowchart LR
377377
A[An Otter Wiki]-- supports ---Mermaid

0 commit comments

Comments
 (0)