www: new fenced code block design (#1629)
This commit is contained in:
@@ -10,13 +10,8 @@ import {
|
||||
TABLE_OF_CONTENTS,
|
||||
TableOfContentsEntry,
|
||||
} from "../../data/docs.ts";
|
||||
import { frontMatter, gfm } from "../../utils/markdown.ts";
|
||||
import { frontMatter, renderMarkdown } from "../../utils/markdown.ts";
|
||||
import toc from "../../../docs/toc.ts";
|
||||
import { mangle } from "$marked-mangle";
|
||||
import { markedSmartypants } from "$marked-smartypants";
|
||||
|
||||
gfm.Marked.marked.use(mangle());
|
||||
gfm.Marked.marked.use(markedSmartypants());
|
||||
|
||||
interface Data {
|
||||
page: Page;
|
||||
@@ -249,7 +244,7 @@ function DesktopSidebar(props: { path: string; page: Page }) {
|
||||
}
|
||||
|
||||
function Content(props: { page: Page }) {
|
||||
const html = gfm.render(props.page.markdown);
|
||||
const html = renderMarkdown(props.page.markdown);
|
||||
return (
|
||||
<main class="py-6 overflow-hidden md:mr-4 lg:mr-32">
|
||||
<h1 class="text(4xl gray-900) tracking-tight font-extrabold mt-6 md:mt-0">
|
||||
|
||||
+39
-1
@@ -3,8 +3,20 @@ import { gfm } from "../utils/markdown.ts";
|
||||
|
||||
// TODO(lucacasonato): hash the file and use the hash as the filename, and serve
|
||||
// with high-cacheability headers.
|
||||
function css(template: TemplateStringsArray, ...params: string[]) {
|
||||
let out = "";
|
||||
|
||||
const CSS = `${gfm.CSS}
|
||||
for (let i = 0; i < template.length; i++) {
|
||||
out += template[i];
|
||||
if (i < params.length) {
|
||||
out += String(params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
const CSS = css`${gfm.CSS}
|
||||
|
||||
ol.nested {
|
||||
counter-reset: item;
|
||||
@@ -39,6 +51,32 @@ ol.nested li:before {
|
||||
.toggle:checked + .toggled {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.fenced-code {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.fenced-code pre {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.fenced-code-header {
|
||||
border-top-left-radius: .5rem;
|
||||
border-top-right-radius: .5rem;
|
||||
padding: 0.5rem;
|
||||
background: #eaeef1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.fenced-code-header + pre {
|
||||
border-top-left-radius: 0 !important;
|
||||
border-top-right-radius: 0 !important;
|
||||
}
|
||||
.fenced-code-title {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
||||
"Liberation Mono", "Courier New", monospace;
|
||||
font-size: .8125rem;
|
||||
line-height: 1;
|
||||
}
|
||||
`;
|
||||
|
||||
export const handler: Handlers = {
|
||||
|
||||
Reference in New Issue
Block a user