From 8672b80527841ad2afd0d17144b939b5ac30c7ee Mon Sep 17 00:00:00 2001 From: curtis-allan Date: Fri, 13 Dec 2024 19:23:35 +1000 Subject: [PATCH] Highlightjs fixes --- fasthtml/js.py | 4 ++-- nbs/api/03_js.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fasthtml/js.py b/fasthtml/js.py index cfbc5b3c..e39e63a8 100644 --- a/fasthtml/js.py +++ b/fasthtml/js.py @@ -23,7 +23,7 @@ def light_media( def dark_media( css: str # CSS to be included in the dark media query ): - "Render dark media for nught mode views" + "Render dark media for night mode views" return Style('@media (prefers-color-scheme: dark) {%s}' %css) # %% ../nbs/api/03_js.ipynb @@ -56,7 +56,7 @@ def KatexMarkdownJS( # %% ../nbs/api/03_js.ipynb def HighlightJS( - sel='pre code', # CSS selector for code elements. Default is industry standard, be careful before adjusting it + sel='pre code:not([data-highlighted="yes"])', # CSS selector for code elements. Default is industry standard, be careful before adjusting it langs:str|list|tuple='python', # Language(s) to highlight light='atom-one-light', # Light theme dark='atom-one-dark' # Dark theme diff --git a/nbs/api/03_js.ipynb b/nbs/api/03_js.ipynb index 08237e84..dffafc62 100644 --- a/nbs/api/03_js.ipynb +++ b/nbs/api/03_js.ipynb @@ -89,7 +89,7 @@ "def dark_media(\n", " css: str # CSS to be included in the dark media query\n", " ):\n", - " \"Render dark media for nught mode views\"\n", + " \"Render dark media for night mode views\"\n", " return Style('@media (prefers-color-scheme: dark) {%s}' %css)" ] }, @@ -228,7 +228,7 @@ "source": [ "#| export\n", "def HighlightJS(\n", - " sel='pre code', # CSS selector for code elements. Default is industry standard, be careful before adjusting it\n", + " sel='pre code:not([data-highlighted=\"yes\"])', # CSS selector for code elements. Default is industry standard, be careful before adjusting it\n", " langs:str|list|tuple='python', # Language(s) to highlight\n", " light='atom-one-light', # Light theme\n", " dark='atom-one-dark' # Dark theme\n",