Skip to content

Commit 5fd06b3

Browse files
committed
Updated table parsing in Markdown.
1 parent bdf17a6 commit 5fd06b3

5 files changed

Lines changed: 96 additions & 44 deletions

File tree

css/notes.css

Lines changed: 88 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* ==========================================================================
2-
NOTES PAGES
3-
========================================================================== */
2+
NOTES PAGES
3+
========================================================================== */
44

55
.course-entry,
66
.note-entry {
7-
border-bottom: 1px solid #ddd;
8-
padding: 0.7rem 0;
97
display: flex;
108
justify-content: space-between;
9+
padding: 0.7rem 0;
10+
border-bottom: 1px solid #ddd;
1111
}
1212

1313
.course-title,
@@ -27,6 +27,14 @@
2727
color: #aaa;
2828
}
2929

30+
/* ==========================================================================
31+
NOTE CONTENT
32+
========================================================================== */
33+
34+
#note-content {
35+
overflow-x: auto;
36+
}
37+
3038
#note-content ul,
3139
#note-content ol {
3240
margin: 0 0 0 1.5rem;
@@ -35,84 +43,122 @@
3543
}
3644

3745
#note-content ul ul,
38-
#note-content ol ul,
3946
#note-content ul ol,
47+
#note-content ol ul,
4048
#note-content ol ol {
4149
margin-left: 3rem;
4250
}
4351

44-
#note-content li+li {
52+
#note-content li + li {
4553
margin-top: 0.25rem;
4654
}
4755

48-
h1 {
56+
#note-content h1 {
4957
font-size: 2rem;
5058
margin-bottom: 0.5rem;
5159
}
5260

61+
/* ==========================================================================
62+
TABLE OF CONTENTS
63+
========================================================================== */
64+
65+
nav.table-of-contents,
5366
.table-of-contents {
5467
border-left: 3px solid #eee;
5568
padding-left: 1em;
5669
margin: 1em 0;
5770
font-size: 0.95em;
5871
}
5972

73+
nav.table-of-contents ul,
6074
.table-of-contents ul {
6175
list-style: none;
6276
margin: 0;
6377
padding: 0;
6478
}
6579

66-
.table-of-contents li+li {
80+
nav.table-of-contents li + li,
81+
.table-of-contents li + li {
6782
margin-top: 0.3em;
6883
}
6984

85+
nav.table-of-contents a,
7086
.table-of-contents a {
87+
display: block;
7188
text-decoration: none;
89+
color: var(--link-color, #0055aa);
7290
border-left: 1px solid var(--border-color, #ddd);
7391
padding-left: 1rem;
74-
margin: 1rem 0;
92+
margin: 0.5em 0;
93+
}
94+
95+
nav.table-of-contents a:hover,
96+
.table-of-contents a:hover {
97+
text-decoration: underline;
98+
}
99+
100+
/* Dark mode variants */
101+
.dark-mode nav.table-of-contents,
102+
.dark-mode .table-of-contents {
103+
border-left-color: var(--border-color, #444);
104+
}
75105

76-
ts a:hover {
77-
font-size: 0.95rem;
78-
text-decoration: underline;
79-
}
106+
.dark-mode nav.table-of-contents a,
107+
.dark-mode .table-of-contents a {
108+
color: var(--link-color);
109+
border-left-color: var(--border-color);
110+
}
111+
112+
.dark-mode nav.table-of-contents a:hover,
113+
.dark-mode .table-of-contents a:hover {
114+
color: var(--link-hover-color);
115+
text-decoration: underline;
116+
}
117+
118+
/* ==========================================================================
119+
MATH JAX IPA
120+
========================================================================== */
121+
122+
.mjx-chtml .ipa {
123+
font-family: "Charis SIL", "Doulos SIL", "Noto Sans IPA", sans-serif;
124+
}
80125

81-
.table-of-contents ul {
82-
list-style: none;
83-
margin: 0;
84-
padding: 0;
85-
}
126+
/* ==========================================================================
127+
TABLE STYLING IN NOTES
128+
========================================================================== */
86129

87-
.table-of-contents li+li {
88-
margin-top: 0.25rem;
89-
}
130+
#note-content table {
131+
border-collapse: collapse;
132+
white-space: nowrap;
133+
min-width: max-content;
134+
}
90135

91-
.table-of-contents a {
92-
text-decoration: none;
93-
color: var(--link-color, #0055aa);
136+
#note-content th,
137+
#note-content td {
138+
border: 1px solid #ccc;
139+
padding: 0.5em 1em;
140+
}
94141

95-
.table-of-contents a:hover {
96-
text-decoration: underline;
97-
}
142+
#note-content tr:nth-child(even) {
143+
background: #fafafa;
144+
}
98145

99-
.dark-mode .table-of-contents {
100-
border-color: #444;
101-
border-left-color: var(--border-color);
102-
}
146+
/* ==========================================================================
147+
TABLE WRAPPER
148+
========================================================================== */
103149

104-
.dark-mode .table-of-contents a {
105-
color: var(--link-color);
106-
border-left-color: var(--border-color);
107-
}
150+
.table-wrapper {
151+
overflow-x: auto;
152+
margin: 1em 0;
153+
}
108154

109-
.dark-mode .table-of-contents a:hover {
110-
text-decoration: underline;
111-
color: var(--link-hover-color);
112-
}
113-
}
155+
.table-wrapper table {
156+
border-collapse: collapse;
157+
white-space: nowrap;
114158
}
115159

116-
.mjx-chtml .ipa {
117-
font-family: "Charis SIL", "Doulos SIL", "Noto Sans IPA", sans-serif;
160+
.table-wrapper th,
161+
.table-wrapper td {
162+
border: 1px solid #ccc;
163+
padding: 0.5em 1em;
118164
}

css/post.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ article#post-content .post-meta {
119119
color: #eee;
120120
}
121121

122-
/* Placeholder in dark mode */
123122
.dark-mode #comment-form textarea::placeholder,
124123
.dark-mode #comment-form input::placeholder {
125124
color: #bbb;

js/markdown.js

Whitespace-only changes.

notes/courses/LING-UA-1/02-phonetics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Articulatory Phonetics: How speech sounds are produces
3030
#### Speech production system
3131
Move different part of mouth for different sounds.
3232

33-
![](images/02-1.png) Image of human vocal tract, from [ link](https://www.researchgate.net/figure/PA-articulation-points-left-Human-vocal-tract-right-IPA-vowels-consonants_fig2_357296500).
33+
![](notes/courses/LING-UA-1/images/02-1.png) Image of human vocal tract, from [ link](https://www.researchgate.net/figure/PA-articulation-points-left-Human-vocal-tract-right-IPA-vowels-consonants_fig2_357296500).
3434

3535
## Consonants
3636
Three key features:

notes/js/note.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ fetch(`/notes/courses/${course}/${noteSlug}.md`)
102102

103103
container.append(contentDiv);
104104

105+
contentDiv.querySelectorAll('table').forEach(table => {
106+
const wrapper = document.createElement('div');
107+
wrapper.className = 'table-wrapper';
108+
table.parentNode.insertBefore(wrapper, table);
109+
wrapper.appendChild(table);
110+
});
111+
105112
if (window.MathJax && MathJax.typesetPromise) {
106113
MathJax.typesetPromise([container])
107114
.catch(err => console.error('MathJax typeset failed:', err));

0 commit comments

Comments
 (0)