shuffle some things about

pull/1890/head
Rich Harris 7 years ago
parent 3d87ce0027
commit 15d25b7374

@ -1,15 +0,0 @@
export default function process_markdown(markdown) {
const match = /---\n([\s\S]+?)\n---/.exec(markdown);
const frontMatter = match[1];
const content = markdown.slice(match[0].length);
const metadata = {};
frontMatter.split('\n').forEach(pair => {
const colonIndex = pair.indexOf(':');
metadata[pair.slice(0, colonIndex).trim()] = pair
.slice(colonIndex + 1)
.trim();
});
return { metadata, content };
}

@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import process_markdown from '../_process_markdown.js';
import process_markdown from '../../../utils/_process_markdown.js';
import marked from 'marked';
// import hljs from 'highlight.js';

@ -1,21 +0,0 @@
import get_sections from './_sections.js';
let json;
export function get(req, res) {
if (!json || process.env.NODE_ENV !== 'production') {
json = JSON.stringify(get_sections().map(section => {
return {
metadata: section.metadata,
subsections: section.subsections,
slug: section.slug
};
}));
}
res.set({
'Content-Type': 'application/json'
});
res.end(json);
}

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import * as fleece from 'golden-fleece';
import process_markdown from '../_process_markdown.js';
import process_markdown from '../../utils/_process_markdown.js';
import marked from 'marked';
import prismjs from 'prismjs'; // prism-highlighter smaller footprint [hljs: 192.5k]

@ -1,6 +1,6 @@
<script context="module">
export async function preload() {
const sections = await this.fetch(`api/guide`).then(r => r.json());
const sections = await this.fetch(`guide.json`).then(r => r.json());
return { sections };
}
</script>

Loading…
Cancel
Save