|
164 | 164 | outline: none; |
165 | 165 | } |
166 | 166 |
|
| 167 | + |
| 168 | + #html-output { |
| 169 | + flex: 1; |
| 170 | + padding: 20px; |
| 171 | + box-sizing: border-box; |
| 172 | + overflow-y: auto; |
| 173 | + background-color: #1e1e1e; |
| 174 | + } |
| 175 | + |
| 176 | + /* Dark Mode Styles */ |
| 177 | + #html-output h1, |
| 178 | + #html-output h2, |
| 179 | + #html-output h3, |
| 180 | + #html-output h4, |
| 181 | + #html-output h5, |
| 182 | + #html-output h6 { |
| 183 | + color: #569cd6; |
| 184 | + border-bottom: 1px solid #444; |
| 185 | + padding-bottom: 0.3em; |
| 186 | + margin-top: 1.5em; |
| 187 | + margin-bottom: 1em; |
| 188 | + } |
| 189 | + |
| 190 | + #html-output h1 { |
| 191 | + font-size: 2em; |
| 192 | + } |
| 193 | + |
| 194 | + #html-output h2 { |
| 195 | + font-size: 1.6em; |
| 196 | + } |
| 197 | + |
| 198 | + #html-output h3 { |
| 199 | + font-size: 1.3em; |
| 200 | + } |
| 201 | + |
| 202 | + #html-output a { |
| 203 | + color: #6a99ff; |
| 204 | + text-decoration: none; |
| 205 | + } |
| 206 | + |
| 207 | + #html-output a:hover { |
| 208 | + text-decoration: underline; |
| 209 | + } |
| 210 | + |
| 211 | + #html-output code { |
| 212 | + background-color: #333; |
| 213 | + padding: 0.2em 0.4em; |
| 214 | + border-radius: 3px; |
| 215 | + font-family: "Consolas", "Monaco", monospace; |
| 216 | + font-size: 0.9em; |
| 217 | + color: #ce9178; |
| 218 | + } |
| 219 | + |
| 220 | + #html-output pre { |
| 221 | + background-color: #282828; |
| 222 | + padding: 15px; |
| 223 | + border-radius: 5px; |
| 224 | + overflow-x: auto; |
| 225 | + border: 1px solid #444; |
| 226 | + } |
| 227 | + |
| 228 | + #html-output pre code { |
| 229 | + background-color: transparent; |
| 230 | + padding: 0; |
| 231 | + color: #d4d4d4; |
| 232 | + font-size: 0.9em; |
| 233 | + } |
| 234 | + |
| 235 | + #html-output blockquote { |
| 236 | + border-left: 4px solid #555; |
| 237 | + padding-left: 15px; |
| 238 | + margin-left: 0; |
| 239 | + color: #aaa; |
| 240 | + } |
| 241 | + |
| 242 | + #html-output ul, |
| 243 | + #html-output ol { |
| 244 | + padding-left: 25px; |
| 245 | + } |
| 246 | + |
| 247 | + #html-output li { |
| 248 | + margin-bottom: 0.5em; |
| 249 | + } |
| 250 | + |
| 251 | + #html-output table { |
| 252 | + border-collapse: collapse; |
| 253 | + margin: 1em 0; |
| 254 | + width: auto; |
| 255 | + border: 1px solid #555; |
| 256 | + } |
| 257 | + |
| 258 | + #html-output th, |
| 259 | + #html-output td { |
| 260 | + border: 1px solid #555; |
| 261 | + padding: 8px 12px; |
| 262 | + } |
| 263 | + |
| 264 | + #html-output th { |
| 265 | + background-color: #333; |
| 266 | + font-weight: bold; |
| 267 | + } |
| 268 | + |
| 269 | + #html-output img { |
| 270 | + max-width: 100%; |
| 271 | + height: auto; |
| 272 | + background-color: #fff; |
| 273 | + /* Added for visibility of transparent images */ |
| 274 | + padding: 5px; |
| 275 | + border-radius: 3px; |
| 276 | + box-sizing: border-box; |
| 277 | + } |
| 278 | + |
| 279 | + /* Styles for the <details> element */ |
| 280 | + #html-output details { |
| 281 | + border: 1px solid #444; |
| 282 | + border-radius: 4px; |
| 283 | + margin: 1em 0; |
| 284 | + background-color: #2a2a2e; |
| 285 | + /* Slightly different background */ |
| 286 | + } |
| 287 | + |
| 288 | + #html-output details[open] { |
| 289 | + background-color: #2f2f33; |
| 290 | + } |
| 291 | + |
| 292 | + #html-output summary { |
| 293 | + padding: 10px 15px; |
| 294 | + cursor: pointer; |
| 295 | + font-weight: bold; |
| 296 | + color: #a0cfff; |
| 297 | + /* Lighter blue for summary */ |
| 298 | + background-color: #333; |
| 299 | + /* Darker background for summary */ |
| 300 | + border-radius: 4px 4px 0 0; |
| 301 | + /* Rounded corners only on top */ |
| 302 | + outline: none; |
| 303 | + /* Remove default focus outline */ |
| 304 | + user-select: none; |
| 305 | + /* Prevent text selection */ |
| 306 | + transition: background-color 0.2s ease; |
| 307 | + } |
| 308 | + |
| 309 | + #html-output details[open] summary { |
| 310 | + border-bottom: 1px solid #444; |
| 311 | + border-radius: 4px 4px 0 0; |
| 312 | + /* Ensure corners remain rounded when open */ |
| 313 | + } |
| 314 | + |
| 315 | + #html-output summary:hover { |
| 316 | + background-color: #3e3e3e; |
| 317 | + } |
| 318 | + |
| 319 | + /* Content inside details */ |
| 320 | + #html-output details>*:not(summary) { |
| 321 | + padding: 0 15px 15px 15px; |
| 322 | + /* Padding only for content */ |
| 323 | + margin-top: 10px; |
| 324 | + /* Add space below summary */ |
| 325 | + } |
| 326 | + |
| 327 | + #html-output summary small { |
| 328 | + font-size: 0.8em; |
| 329 | + color: #999; |
| 330 | + } |
| 331 | + |
| 332 | + /* Ensure first element inside details (after summary) has correct top margin */ |
| 333 | + #html-output details>*:nth-child(2) { |
| 334 | + /* Selects first element after summary */ |
| 335 | + margin-top: 10px !important; |
| 336 | + } |
| 337 | + |
| 338 | + /* Reset margin for elements directly inside details to avoid double margins */ |
| 339 | + #html-output details>p, |
| 340 | + #html-output details>ul, |
| 341 | + #html-output details>ol, |
| 342 | + #html-output details>blockquote, |
| 343 | + #html-output details>pre, |
| 344 | + #html-output details>table, |
| 345 | + #html-output details>h1, |
| 346 | + #html-output details>h2, |
| 347 | + #html-output details>h3, |
| 348 | + #html-output details>h4, |
| 349 | + #html-output details>h5, |
| 350 | + #html-output details>h6 { |
| 351 | + margin-left: 0; |
| 352 | + margin-right: 0; |
| 353 | + } |
| 354 | + |
| 355 | + /* Adjust padding for nested blockquotes etc. if needed */ |
| 356 | + #html-output details blockquote { |
| 357 | + margin-left: 0; |
| 358 | + /* Reset blockquote margin inside details */ |
| 359 | + } |
| 360 | + |
| 361 | + |
167 | 362 | #fileInput { |
168 | 363 | display: none; |
169 | 364 | } |
@@ -280,7 +475,7 @@ <h1>PDF to Markdown Converter</h1> |
280 | 475 | contentDiv.innerHTML = ''; |
281 | 476 | if (previewToggle.checked) { |
282 | 477 | const previewArea = document.createElement('div'); |
283 | | - previewArea.id = 'content-area'; |
| 478 | + previewArea.id = 'html-output'; |
284 | 479 | try { |
285 | 480 | marked.setOptions({ gfm: true, breaks: false, sanitize: true }); // Disable breaks for better paragraph flow |
286 | 481 | previewArea.innerHTML = marked.parse(rawMarkdown || ''); |
|
0 commit comments