Skip to content

Commit 4968115

Browse files
committed
disable katex by default
1 parent 3c683dc commit 4968115

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
@@ -164,4 +164,4 @@ cython_debug/
164164
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
165165
# and can be added to the global gitignore or merged into this file. For a more nuclear
166166
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
167-
#.idea/
167+
.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
@@ -183,7 +183,7 @@ def _generate_next_value_(name, start, count, last_values): return name
183183
violet = auto()
184184
zinc = auto()
185185

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

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

260-
def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=True, apex_charts=False, radii='md', shadows='sm', font='sm'):
260+
def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=False, apex_charts=False, radii='md', shadows='sm', font='sm'):
261261
"Create headers using local files downloaded from CDNs"
262262
Path(static_dir).mkdir(exist_ok=True)
263263
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
@@ -334,7 +334,7 @@
334334
" violet = auto()\n",
335335
" zinc = auto()\n",
336336
"\n",
337-
" def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs=False, katex=True, apex_charts=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm):\n",
337+
" def _create_headers(self, urls, mode='auto', icons=True, daisy=True, highlightjs=False, katex=False, apex_charts=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm):\n",
338338
" \"Create header elements with given URLs\"\n",
339339
" hdrs = [\n",
340340
" fh.Link(rel=\"stylesheet\", href=urls['franken_css']),\n",
@@ -404,25 +404,90 @@
404404
" ]\n",
405405
" return hdrs\n",
406406
"\n",
407-
" def headers(self, mode='auto', icons=True, daisy=True, highlightjs=False, katex=True, apex_charts=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm ):\n",
407+
" def headers(self, mode='auto', icons=True, daisy=True, highlightjs=False, katex=False, apex_charts=False, radii=ThemeRadii.sm, shadows=ThemeShadows.sm, font=ThemeFont.sm ):\n",
408408
" \"Create frankenui and tailwind cdns\"\n",
409409
" return self._create_headers(HEADER_URLS, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, apex_charts=apex_charts, radii=radii, shadows=shadows, font=font) \n",
410410
" \n",
411-
" def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=True, apex_charts=False, radii='md', shadows='sm', font='sm'):\n",
411+
" def local_headers(self, mode='auto', static_dir='static', icons=True, daisy=True, highlightjs=False, katex=False, apex_charts=False, radii='md', shadows='sm', font='sm'):\n",
412412
" \"Create headers using local files downloaded from CDNs\"\n",
413413
" Path(static_dir).mkdir(exist_ok=True)\n",
414414
" local_urls = dict([_download_resource(url, static_dir) for url in HEADER_URLS.items()])\n",
415415
" return self._create_headers(local_urls, mode=mode, icons=icons, daisy=daisy, highlightjs=highlightjs, katex=katex, apex_charts=apex_charts, radii=radii, shadows=shadows, font=font)"
416416
]
417417
},
418+
{
419+
"cell_type": "code",
420+
"execution_count": null,
421+
"metadata": {},
422+
"outputs": [
423+
{
424+
"name": "stdout",
425+
"output_type": "stream",
426+
"text": [
427+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/core.min.css\n",
428+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/core.iife.js\n",
429+
"https://cdn.tailwindcss.com/3.4.16\n",
430+
"inline\n",
431+
"inline\n",
432+
"inline\n",
433+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/icon.iife.js\n",
434+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css\n",
435+
"inline\n"
436+
]
437+
}
438+
],
439+
"source": [
440+
"for h in Theme.blue.headers(): print(h.href or h.src or \"inline\")"
441+
]
442+
},
443+
{
444+
"cell_type": "markdown",
445+
"metadata": {},
446+
"source": [
447+
"`katex` and `highlightjs` are not included by default. To include them set `katex=True` or `highlightjs=True` when calling `.headers`."
448+
]
449+
},
450+
{
451+
"cell_type": "code",
452+
"execution_count": null,
453+
"metadata": {},
454+
"outputs": [
455+
{
456+
"name": "stdout",
457+
"output_type": "stream",
458+
"text": [
459+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/core.min.css\n",
460+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/core.iife.js\n",
461+
"https://cdn.tailwindcss.com/3.4.16\n",
462+
"inline\n",
463+
"inline\n",
464+
"inline\n",
465+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/icon.iife.js\n",
466+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css\n",
467+
"inline\n",
468+
"https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js\n",
469+
"https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/languages/python.min.js\n",
470+
"https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/atom-one-light.css\n",
471+
"https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/atom-one-dark.css\n",
472+
"https://cdn.jsdelivr.net/gh/arronhunt/highlightjs-copy/dist/highlightjs-copy.min.js\n",
473+
"https://cdn.jsdelivr.net/gh/arronhunt/highlightjs-copy/dist/highlightjs-copy.min.css\n",
474+
"inline\n",
475+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css\n",
476+
"inline\n"
477+
]
478+
}
479+
],
480+
"source": [
481+
"for h in Theme.blue.headers(katex=True, highlightjs=True): print(h.href or h.src or \"inline\")"
482+
]
483+
},
418484
{
419485
"cell_type": "code",
420486
"execution_count": null,
421487
"metadata": {},
422488
"outputs": [],
423489
"source": [
424-
"hdrs = Theme.blue.headers()\n",
425-
"app = FastHTML(hdrs=hdrs)"
490+
"app = FastHTML(hdrs=Theme.blue.headers())"
426491
]
427492
},
428493
{
@@ -462,9 +527,9 @@
462527
],
463528
"metadata": {
464529
"kernelspec": {
465-
"display_name": "python3",
530+
"display_name": "python",
466531
"language": "python",
467-
"name": "python3"
532+
"name": "python"
468533
}
469534
},
470535
"nbformat": 4,

0 commit comments

Comments
 (0)