Skip to content

Commit 894f219

Browse files
authored
Merge pull request #101 from banua-coder/hotfix/1.5.1
hotfix(1.5.1): make math formulas, code blocks, and params table scrollable on mobile
2 parents a010b16 + e132081 commit 894f219

4 files changed

Lines changed: 63 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pico-api-docs",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "PICO SulTeng API Documentation - COVID-19 Sulawesi Tengah Data API",
55
"main": "index.js",
66
"scripts": {

src/components/CodeBlock.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,10 @@ onMounted(() => {
265265

266266
<style scoped>
267267
.code-block-wrapper {
268-
@apply rounded-lg overflow-hidden my-4 transition-colors duration-200;
268+
@apply rounded-lg my-4 transition-colors duration-200;
269269
@apply border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900;
270+
overflow: hidden; /* keep border-radius clipping */
271+
max-width: 100%;
270272
}
271273
272274
.code-block-wrapper.dark-theme {
@@ -319,8 +321,11 @@ onMounted(() => {
319321
}
320322
321323
.code-container {
322-
@apply relative overflow-x-auto;
323-
@apply bg-white dark:bg-gray-900;
324+
@apply relative bg-white dark:bg-gray-900;
325+
overflow-x: auto;
326+
overflow-y: hidden;
327+
-webkit-overflow-scrolling: touch;
328+
max-width: 100%;
324329
}
325330
326331
.dark-theme .code-container {
@@ -331,6 +336,10 @@ onMounted(() => {
331336
@apply m-0 p-4 text-xs sm:text-sm font-mono leading-relaxed;
332337
background: transparent !important;
333338
font-family: 'Fira Code', 'JetBrains Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
339+
white-space: pre;
340+
word-break: normal;
341+
word-wrap: normal;
342+
min-width: min-content;
334343
}
335344
336345
.code-container code {

src/components/MathFormula.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,23 @@ const renderedMath = computed(() => {
3333
.katex-formula {
3434
display: block;
3535
text-align: center;
36+
overflow-x: auto;
37+
overflow-y: hidden;
38+
-webkit-overflow-scrolling: touch;
39+
max-width: 100%;
40+
padding-bottom: 4px; /* space for scrollbar */
41+
}
42+
43+
/* Ensure KaTeX inner elements don't force overflow */
44+
.katex-formula :deep(.katex-display) {
45+
overflow-x: auto;
46+
overflow-y: hidden;
47+
max-width: 100%;
48+
margin: 0.5em 0;
49+
}
50+
51+
.katex-formula :deep(.katex-html) {
52+
overflow-x: auto;
53+
max-width: 100%;
3654
}
3755
</style>

src/style.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,38 @@ body {
108108
* { animation: none !important; transition-duration: 0.01ms !important; }
109109
}
110110

111+
/* Mobile overflow fixes */
112+
@media (max-width: 768px) {
113+
/* Ensure code blocks are scrollable on mobile */
114+
.code-block-wrapper,
115+
.code-container,
116+
.code-panel,
117+
.code-panel pre {
118+
overflow-x: auto !important;
119+
-webkit-overflow-scrolling: touch;
120+
max-width: 100%;
121+
}
122+
123+
/* Ensure params table is scrollable */
124+
.params-table {
125+
display: block;
126+
overflow-x: auto;
127+
-webkit-overflow-scrolling: touch;
128+
white-space: nowrap;
129+
}
130+
131+
.params-table td,
132+
.params-table th {
133+
white-space: normal;
134+
min-width: 80px;
135+
}
136+
137+
.params-table td:last-child {
138+
min-width: 150px;
139+
white-space: normal;
140+
}
141+
}
142+
111143
/* Dark mode code syntax colors */
112144
.token-string { color: #a3e4c9; }
113145
.token-number { color: #f97316; }

0 commit comments

Comments
 (0)