API reference
A plain CSS package for rendering SkyScribe Document content: no JavaScript, no build step. Every rule is scoped to .scribe-content, so nothing leaks into the rest of your page. See the Styles guide for set-up in each framework.
npm install @skyscribe-sdk/styles
Import the stylesheet once, in the route that renders Document content:
import "@skyscribe-sdk/styles";
Then wrap your Document's HTML in an element with the scribe-content class. The easiest way is the <ScribeContent> component from @skyscribe-sdk/react, which adds the class automatically:
import { ScribeContent } from "@skyscribe-sdk/react";
import "@skyscribe-sdk/styles";
<ScribeContent html={document.content} />
Without React, add the class to whatever element you render the HTML into:
<div class="scribe-content"><!-- document.content --></div>
| Element | Selector |
|---|---|
| Code blocks | .scribe-content pre |
| Inline code | .scribe-content :not(pre) > code |
| Syntax tokens | .scribe-content .token.keyword etc. |
| Images | .scribe-content img |
| Blockquotes | .scribe-content blockquote |
| Horizontal rules | .scribe-content hr |
| Tables | .scribe-content table, th, td |
| Ordered / unordered lists | .scribe-content ul, .scribe-content ol |
| Checklists | .scribe-content li[role="checkbox"] |
| Embeds, Posters and link cards | .scribe-content figure[data-embed] |
The syntax token classes (token keyword, token string, …) are the Prism-compatible class names the SkyScribe editor puts on highlighted code. The default colours match Prism's light theme.
Override any --scribe-* custom property on .scribe-content (or a parent element) to change the look. That's also how to support dark mode:
.my-article.dark {
--scribe-code-bg: #1e1e1e;
--scribe-code-border: #333;
--scribe-inline-code-bg: rgba(255, 255, 255, 0.08);
--scribe-blockquote-border: #555;
--scribe-blockquote-color: #aaa;
--scribe-hr-color: #444;
--scribe-table-border: #555;
--scribe-table-header-bg: rgba(255, 255, 255, 0.06);
--scribe-embed-border: #444;
--scribe-embed-muted: #aaa;
/* VS Code dark+ palette */
--scribe-token-keyword: #569cd6;
--scribe-token-string: #ce9178;
--scribe-token-comment: #6a9955;
--scribe-token-function: #dcdcaa;
--scribe-token-variable: #9cdcfe;
--scribe-token-property: #4ec9b0;
--scribe-token-punctuation: #d4d4d4;
--scribe-token-operator: #d4d4d4;
}
Code blocks and inline code
| Property | Default | Description |
|---|---|---|
--scribe-code-bg | #f5f5f5 | Code block background |
--scribe-code-border | #e0e0e0 | Code block border colour |
--scribe-code-font | "Courier New", Courier, monospace | Font family for all code |
--scribe-code-font-size | 0.875em | Font size for all code |
--scribe-inline-code-bg | rgba(0,0,0,0.06) | Inline code background |
Blockquotes
| Property | Default | Description |
|---|---|---|
--scribe-blockquote-border | #ccc | Left border colour |
--scribe-blockquote-color | #666 | Text colour |
Horizontal rules and tables
| Property | Default | Description |
|---|---|---|
--scribe-hr-color | #ddd | Horizontal rule colour |
--scribe-table-border | #ccc | Table cell borders |
--scribe-table-header-bg | rgba(0,0,0,0.04) | Header row background |
Embeds
| Property | Default | Description |
|---|---|---|
--scribe-embed-border | #ddd | Link card border |
--scribe-embed-radius | 8px | Corner radius of players, Posters and link cards |
--scribe-embed-muted | #666 | Link card description, and its border on hover |
--scribe-embed-poster-bg | #1f1f1f | A Poster with no thumbnail |
--scribe-embed-poster-fg | #fff | Text on a Poster with no thumbnail |
--scribe-embed-poster-button-bg | #fff | A Poster's Play / Load player button, and its focus ring |
--scribe-embed-poster-button-fg | #111 | The button's text |
Checklists
| Property | Default | Description |
|---|---|---|
--scribe-checkbox-size | 1em | Checkbox width and height |
--scribe-checkbox-border | #aaa | Border of an unchecked item |
--scribe-checkbox-checked-bg | #333 | Fill of a checked item |
--scribe-checkbox-checked-border | #333 | Border of a checked item |
Syntax token colours
| Property | Default | Applies to |
|---|---|---|
--scribe-token-comment | #708090 | comment, prolog, doctype, cdata |
--scribe-token-punctuation | #555 | punctuation |
--scribe-token-property | #905 | property, tag, boolean, number, constant, symbol, deleted |
--scribe-token-string | #690 | string, selector, attr, char, builtin, inserted |
--scribe-token-operator | #9a6e3a | operator, entity, url |
--scribe-token-keyword | #07a | keyword, atrule |
--scribe-token-function | #dd4a68 | function, class-name, class |
--scribe-token-variable | #e90 | variable, regex, important |