-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
138 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,9 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>@celine/celine</title> | ||
|
||
<link rel="stylesheet" href="styles/libertine.css" /> | ||
<link rel="stylesheet" href="stylesheets/libertine.css" /> | ||
<link rel="stylesheet" href="stylesheets/echo.css" /> | ||
<link rel="stylesheet" href="stylesheets/reflect.css" /> | ||
|
||
<meta name="description" content="A microlibrary for building reactive HTML notebooks"> | ||
<meta name="author" content="Max Bo"> | ||
|
@@ -27,48 +29,6 @@ | |
<meta name="twitter:description" content="A microlibrary for building reactive HTML notebooks"> | ||
|
||
<style> | ||
script.echo::before { | ||
content: "<script type=\"" attr(type) "\" class=\"" attr(class) "\" id=\"" attr(id) "\" contenteditable=\"" attr(contenteditable) "\">"; | ||
} | ||
|
||
script.echo::after { | ||
content: "<\/script>"; | ||
} | ||
|
||
style.echo::before { | ||
content: "<style class=\"" attr(class) "\" contenteditable=\"" attr(contenteditable) "\">"; | ||
} | ||
|
||
style.echo::after { | ||
content: "<\/style>"; | ||
} | ||
|
||
/* | ||
Josh's Custom CSS Reset | ||
https://www.joshwcomeau.com/css/custom-css-reset/ | ||
*/ | ||
*, *::before, *::after { | ||
box-sizing: border-box; | ||
} | ||
* { | ||
margin: 0; | ||
} | ||
body { | ||
-webkit-font-smoothing: antialiased; | ||
} | ||
img, picture, video, canvas, svg { | ||
display: block; | ||
max-width: 100%; | ||
} | ||
input, button, textarea, select { | ||
font: inherit; | ||
} | ||
p, h1, h2, h3, h4, h5, h6 { | ||
overflow-wrap: break-word; | ||
} | ||
#root, #__next { | ||
isolation: isolate; | ||
} | ||
</style> | ||
</head> | ||
|
||
|
@@ -121,47 +81,7 @@ <h1 class="title">@celine/celine</h1> | |
|
||
<h2><a href="#installation" id="installation" class="self-link"></a>Installation</h2> | ||
|
||
<p>Add the following <code>style</code> and <code>script</code> elements to your HTML file. Customize to your liking.</p> | ||
|
||
<style class="echo"> | ||
/* https://blog.glyphdrawing.club/font-with-built-in-syntax-highlighting/ */ | ||
@font-face { | ||
font-family: 'FontWithASyntaxHighlighter'; | ||
src: | ||
url('https://maxbo.me/celine/fonts/FontWithASyntaxHighlighter-Regular.woff2') format('woff2'); | ||
} | ||
|
||
.echo { | ||
display: block; | ||
overflow: auto; | ||
font-family: "FontWithASyntaxHighlighter", monospace; | ||
font-feature-settings: "colr", "calt"; | ||
white-space: pre; | ||
color: #eee; | ||
font-size: 0.9rem; | ||
background-color: #282828; | ||
} | ||
|
||
.observablehq { | ||
margin-top: 1rem; | ||
} | ||
|
||
@keyframes blink { | ||
67% { | ||
opacity: 0; | ||
} | ||
} | ||
.observablehq--running::before { | ||
content: 'LOADING'; | ||
animation: blink 1s step-end infinite; | ||
} | ||
|
||
.observablehq--error { | ||
color: #d00; | ||
} | ||
</style> | ||
|
||
<br /> | ||
<p>Add the following <code><script></code> element to your HTML file:</p> | ||
|
||
<script type="module" class="echo"> | ||
import { CelineModule, reevaluateOnBlur } from 'https://esm.sh/jsr/@celine/[email protected]'; | ||
|
@@ -176,6 +96,37 @@ <h2><a href="#installation" id="installation" class="self-link"></a>Installation | |
reevaluateOnBlur(document, /*class=*/'echo'); | ||
</script> | ||
|
||
<p>Additionally, celine comes with some drop in stylesheets that can be added to your <code><head></code> block. </p> | ||
|
||
<em>As these are unversioned stylesheets, please vendor them if you require them to remain unchanged.</em> | ||
|
||
<p><a href="stylesheets/libertine.css">libertine.css</a> is a <a href="https://dohliam.github.io/dropin-minimal-css/">drop-in serif-based stylesheet</a>, roughly imitating the look of <a href="https://typst.app/">Typst</a> papers.</p> | ||
|
||
<pre class="echo" style="margin-bottom: 1ch;"> | ||
<link | ||
rel="stylesheet" | ||
href="https://maxbo.me/celine/styles/libertine.css" | ||
crossorigin="anonymous" /> | ||
</pre> | ||
|
||
<p><a href="stylesheets/echo.css">echo.css</a>'s <code>.echo</code> class can be used on <code><script></code> and <code><style></code> elements to display them inline, with a <a href="https://blog.glyphdrawing.club/font-with-built-in-syntax-highlighting/">font with built-in syntax highlighting</a>.</p> | ||
|
||
<pre class="echo" style="margin-bottom: 1ch;"> | ||
<link | ||
rel="stylesheet" | ||
href="https://maxbo.me/celine/styles/echo.css" | ||
crossorigin="anonymous" /> | ||
</pre> | ||
|
||
<p><a href="stylesheets/reflect.css">reflect.css</a>'s forces <code><script></code> and <code><style></code> to display their opening and closing tags, <code>type</code>, <code>id</code>, and <code>contenteditable</code> attributes.</p> | ||
<pre class="echo" style="margin-bottom: 1ch;"> | ||
<link | ||
rel="stylesheet" | ||
href="https://maxbo.me/celine/styles/reflect.css" | ||
crossorigin="anonymous" /> | ||
</pre> | ||
|
||
|
||
<h2><a href="#api" id="api" class="self-link"></a>API</h2> | ||
|
||
<p>All of the following <code>script</code>s are marked <code>contenteditable</code> and reevaluate on blur.</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@font-face { | ||
font-family: 'FontWithASyntaxHighlighter'; | ||
src: | ||
url('./fonts/FontWithASyntaxHighlighter-Regular.woff2') format('woff2'); | ||
} | ||
|
||
.echo { | ||
display: block; | ||
overflow: auto; | ||
font-family: "FontWithASyntaxHighlighter", monospace; | ||
font-feature-settings: "colr", "calt"; | ||
white-space: pre; | ||
color: #eee; | ||
font-size: 0.9rem; | ||
background-color: #282828; | ||
} | ||
|
||
.observablehq { | ||
margin-top: 1rem; | ||
} | ||
|
||
@keyframes blink { | ||
67% { | ||
opacity: 0; | ||
} | ||
} | ||
.observablehq--running::before { | ||
content: 'LOADING'; | ||
animation: blink 1s step-end infinite; | ||
} | ||
|
||
.observablehq--error { | ||
color: #d00; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
script::before { | ||
content: "<script type=\"" attr(type) "\" class=\"" attr(class) "\" id=\"" attr(id) "\" contenteditable=\"" attr(contenteditable) "\">"; | ||
} | ||
|
||
script::after { | ||
content: "<\/script>"; | ||
} | ||
|
||
style::before { | ||
content: "<style class=\"" attr(class) "\" contenteditable=\"" attr(contenteditable) "\">"; | ||
} | ||
|
||
style::after { | ||
content: "<\/style>"; | ||
} |