Skip to content

Commit 5e67e56

Browse files
committed
disable katex by default
1 parent 9d93c6b commit 5e67e56

File tree

5 files changed

+80
-11
lines changed

5 files changed

+80
-11
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,4 @@ cython_debug/
163163
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164164
# and can be added to the global gitignore or merged into this file. For a more nuclear
165165
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
166-
#.idea/
166+
.idea/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ app, rt = fast_app(hdrs=Theme.slate.headers())
8282
> *The color option can be any of the theme options available out of the
8383
> box*
8484
85+
> `katex` and `highlightjs` are not included by default. To include them set `katex=True` or `highlightjs=True` when calling `.headers`. (i.e. `Theme.slate.headers(katex=True)`)*
86+
8587
From here, you can explore the API Reference & examples to see how to
8688
implement the components. You can also check out these demo videos to as
8789
a quick start guide:

docs/getting_started/GettingStarted.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ app, rt = fast_app(hdrs=Theme.slate.headers())
8181
> *The color option can be any of the theme options available out of the
8282
> box*
8383
84+
> `katex` and `highlightjs` are not included by default. To include them set `katex=True` or `highlightjs=True` when calling `.headers`. (i.e. `Theme.slate.headers(katex=True)`)*
85+
8486
From here, you can explore the API Reference & examples to see how to
8587
implement the components. You can also check out these demo videos to as
8688
a quick start guide:

monsterui/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def _generate_next_value_(name, start, count, last_values): return name
182182
violet = auto()
183183
zinc = auto()
184184

185-
def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs=False, katex=True, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm):
185+
def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs=False, katex=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm):
186186
"Create header elements with given URLs"
187187
hdrs = [
188188
fh.Link(rel="stylesheet", href=urls['franken_css']),
@@ -251,11 +251,11 @@ def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs
251251
]
252252
return hdrs
253253

254-
def headers(self, mode='auto', icons=True, daisy=True, highlightjs=False, katex=True, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm ):
254+
def headers(self, mode='auto', icons=True, daisy=True, highlightjs=False, katex=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm ):
255255
"Create frankenui and tailwind cdns"
256256
return self._create_headers(HEADER_URLS, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font)
257257

258-
def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=True, radii='md', shadows='sm', font='sm'):
258+
def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=False, radii='md', shadows='sm', font='sm'):
259259
"Create headers using local files downloaded from CDNs"
260260
Path(static_dir).mkdir(exist_ok=True)
261261
local_urls = dict([_download_resource(url, static_dir) for url in HEADER_URLS.items()])

nbs/01_core.ipynb

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@
333333
" violet = auto()\n",
334334
" zinc = auto()\n",
335335
"\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",
337337
" \"Create header elements with given URLs\"\n",
338338
" hdrs = [\n",
339339
" fh.Link(rel=\"stylesheet\", href=urls['franken_css']),\n",
@@ -402,25 +402,90 @@
402402
" ]\n",
403403
" return hdrs\n",
404404
"\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",
406406
" \"Create frankenui and tailwind cdns\"\n",
407407
" return self._create_headers(HEADER_URLS, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font) \n",
408408
" \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",
410410
" \"Create headers using local files downloaded from CDNs\"\n",
411411
" Path(static_dir).mkdir(exist_ok=True)\n",
412412
" local_urls = dict([_download_resource(url, static_dir) for url in HEADER_URLS.items()])\n",
413413
" return self._create_headers(local_urls, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, radii=radii, shadows=shadows, font=font)"
414414
]
415415
},
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+
},
416482
{
417483
"cell_type": "code",
418484
"execution_count": null,
419485
"metadata": {},
420486
"outputs": [],
421487
"source": [
422-
"hdrs = Theme.blue.headers()\n",
423-
"app = FastHTML(hdrs=hdrs)"
488+
"app = FastHTML(hdrs=Theme.blue.headers())"
424489
]
425490
},
426491
{
@@ -460,9 +525,9 @@
460525
],
461526
"metadata": {
462527
"kernelspec": {
463-
"display_name": "python3",
528+
"display_name": "python",
464529
"language": "python",
465-
"name": "python3"
530+
"name": "python"
466531
}
467532
},
468533
"nbformat": 4,

0 commit comments

Comments
 (0)