|
333 | 333 | " violet = auto()\n",
|
334 | 334 | " zinc = auto()\n",
|
335 | 335 | "\n",
|
336 |
| - " def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs=False, katex=True, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm):\n", |
| 336 | + " def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs=False, katex=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm):\n", |
337 | 337 | " \"Create header elements with given URLs\"\n",
|
338 | 338 | " hdrs = [\n",
|
339 | 339 | " fh.Link(rel=\"stylesheet\", href=urls['franken_css']),\n",
|
|
402 | 402 | " ]\n",
|
403 | 403 | " return hdrs\n",
|
404 | 404 | "\n",
|
405 |
| - " def headers(self, mode='auto', icons=True, daisy=True, highlightjs=False, katex=True, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm ):\n", |
| 405 | + " def headers(self, mode='auto', icons=True, daisy=True, highlightjs=False, katex=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm ):\n", |
406 | 406 | " \"Create frankenui and tailwind cdns\"\n",
|
407 | 407 | " return self._create_headers(HEADER_URLS, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font) \n",
|
408 | 408 | " \n",
|
409 |
| - " def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=True, radii='md', shadows='sm', font='sm'):\n", |
| 409 | + " def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=False, radii='md', shadows='sm', font='sm'):\n", |
410 | 410 | " \"Create headers using local files downloaded from CDNs\"\n",
|
411 | 411 | " Path(static_dir).mkdir(exist_ok=True)\n",
|
412 | 412 | " local_urls = dict([_download_resource(url, static_dir) for url in HEADER_URLS.items()])\n",
|
413 | 413 | " return self._create_headers(local_urls, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font)"
|
414 | 414 | ]
|
415 | 415 | },
|
| 416 | + { |
| 417 | + "cell_type": "code", |
| 418 | + "execution_count": null, |
| 419 | + "metadata": {}, |
| 420 | + "outputs": [ |
| 421 | + { |
| 422 | + "name": "stdout", |
| 423 | + "output_type": "stream", |
| 424 | + "text": [ |
| 425 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/core.min.css\n", |
| 426 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/core.iife.js\n", |
| 427 | + "https://cdn.tailwindcss.com/3.4.16\n", |
| 428 | + "inline\n", |
| 429 | + "inline\n", |
| 430 | + "inline\n", |
| 431 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/icon.iife.js\n", |
| 432 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css\n", |
| 433 | + "inline\n" |
| 434 | + ] |
| 435 | + } |
| 436 | + ], |
| 437 | + "source": [ |
| 438 | + "for h in Theme.blue.headers(): print(h.href or h.src or \"inline\")" |
| 439 | + ] |
| 440 | + }, |
| 441 | + { |
| 442 | + "cell_type": "markdown", |
| 443 | + "metadata": {}, |
| 444 | + "source": [ |
| 445 | + "`katex` and `highlightjs` are not included by default. To include them set `katex=True` or `highlightjs=True` when calling `.headers`." |
| 446 | + ] |
| 447 | + }, |
| 448 | + { |
| 449 | + "cell_type": "code", |
| 450 | + "execution_count": null, |
| 451 | + "metadata": {}, |
| 452 | + "outputs": [ |
| 453 | + { |
| 454 | + "name": "stdout", |
| 455 | + "output_type": "stream", |
| 456 | + "text": [ |
| 457 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/core.min.css\n", |
| 458 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/core.iife.js\n", |
| 459 | + "https://cdn.tailwindcss.com/3.4.16\n", |
| 460 | + "inline\n", |
| 461 | + "inline\n", |
| 462 | + "inline\n", |
| 463 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/icon.iife.js\n", |
| 464 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css\n", |
| 465 | + "inline\n", |
| 466 | + "https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js\n", |
| 467 | + "https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/languages/python.min.js\n", |
| 468 | + "https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/atom-one-light.css\n", |
| 469 | + "https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/atom-one-dark.css\n", |
| 470 | + "https://cdn.jsdelivr.net/gh/arronhunt/highlightjs-copy/dist/highlightjs-copy.min.js\n", |
| 471 | + "https://cdn.jsdelivr.net/gh/arronhunt/highlightjs-copy/dist/highlightjs-copy.min.css\n", |
| 472 | + "inline\n", |
| 473 | + "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css\n", |
| 474 | + "inline\n" |
| 475 | + ] |
| 476 | + } |
| 477 | + ], |
| 478 | + "source": [ |
| 479 | + "for h in Theme.blue.headers(katex=True, highlightjs=True): print(h.href or h.src or \"inline\")" |
| 480 | + ] |
| 481 | + }, |
416 | 482 | {
|
417 | 483 | "cell_type": "code",
|
418 | 484 | "execution_count": null,
|
419 | 485 | "metadata": {},
|
420 | 486 | "outputs": [],
|
421 | 487 | "source": [
|
422 |
| - "hdrs = Theme.blue.headers()\n", |
423 |
| - "app = FastHTML(hdrs=hdrs)" |
| 488 | + "app = FastHTML(hdrs=Theme.blue.headers())" |
424 | 489 | ]
|
425 | 490 | },
|
426 | 491 | {
|
|
460 | 525 | ],
|
461 | 526 | "metadata": {
|
462 | 527 | "kernelspec": {
|
463 |
| - "display_name": "python3", |
| 528 | + "display_name": "python", |
464 | 529 | "language": "python",
|
465 |
| - "name": "python3" |
| 530 | + "name": "python" |
466 | 531 | }
|
467 | 532 | },
|
468 | 533 | "nbformat": 4,
|
|
0 commit comments