Skip to content

Commit

Permalink
Push
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxwellBo committed Oct 14, 2024
1 parent 30dc200 commit c1441eb
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 88 deletions.
119 changes: 35 additions & 84 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>

Expand Down Expand Up @@ -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>&lt;script&gt;</code> element to your HTML file:</p>

<script type="module" class="echo">
import { CelineModule, reevaluateOnBlur } from 'https://esm.sh/jsr/@celine/[email protected]';
Expand All @@ -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>&lt;head&gt;</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;">
&lt;link
rel=&quot;stylesheet&quot;
href=&quot;https://maxbo.me/celine/styles/libertine.css&quot;
crossorigin=&quot;anonymous&quot; /&gt;
</pre>

<p><a href="stylesheets/echo.css">echo.css</a>'s <code>.echo</code> class can be used on <code>&lt;script&gt;</code> and <code>&lt;style&gt;</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;">
&lt;link
rel=&quot;stylesheet&quot;
href=&quot;https://maxbo.me/celine/styles/echo.css&quot;
crossorigin=&quot;anonymous&quot; /&gt;
</pre>

<p><a href="stylesheets/reflect.css">reflect.css</a>'s forces <code>&lt;script&gt;</code> and <code>&lt;style&gt;</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;">
&lt;link
rel=&quot;stylesheet&quot;
href=&quot;https://maxbo.me/celine/styles/reflect.css&quot;
crossorigin=&quot;anonymous&quot; /&gt;
</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>
Expand Down
34 changes: 34 additions & 0 deletions docs/stylesheets/echo.css
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;
}
58 changes: 54 additions & 4 deletions docs/styles/libertine.css → docs/stylesheets/libertine.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ h1, h2, h3, h4, h5, h6 {
margin-top: 2ch;
}

script, style {
font-family: 'FontWithASyntaxHighlighter', monospace;
}

a.self-link {
transition: opacity 0.2s;
opacity: 0.5;
Expand Down Expand Up @@ -138,4 +134,58 @@ p {

.subtitle {
font-style: italic;
}

code {
border: 1px solid #DDDDDDDD;
background-color: #EEEEEEEE;
padding: 1px;
}

@font-face {
font-family: 'FontWithASyntaxHighlighter';
src:
url('./fonts/FontWithASyntaxHighlighter-Regular.woff2') format('woff2');
}

.font-with-a-syntax-highlighter {
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;
}

script, pre, style {
margin-bottom: 1ch;
}

/*
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;
}
15 changes: 15 additions & 0 deletions docs/stylesheets/reflect.css
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>";
}

0 comments on commit c1441eb

Please sign in to comment.