Tycho fixes
This commit is contained in:
parent
1581095d72
commit
f25550080b
4 changed files with 5 additions and 3 deletions
|
@ -21,6 +21,6 @@ export async function renderToString(result: any, componentFactory: AstroCompone
|
|||
export async function renderPage(result: any, Component: AstroComponentFactory, props: any, children: any) {
|
||||
const template = await renderToString(result, Component, props, children);
|
||||
const styles = Array.from(result.styles).map((style) => `<style>${style}</style>`);
|
||||
const scripts = Array.from(result.scripts);
|
||||
const scripts = Array.from(result.scripts).map((script) => `<script type="module">${script}</script>`);
|
||||
return template.replace('</head>', styles.join('\n') + scripts.join('\n') + '</head>');
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ export function rehypeCodeBlock() {
|
|||
const escapeCode = (code: Element): void => {
|
||||
code.children = code.children.map((child) => {
|
||||
if (child.type === 'text') {
|
||||
return { ...child, value: child.value.replace(/\{/g, '{') };
|
||||
return { ...child, value: `{\`${child.value.replace(/\$\{/g, '\\$\\{').replace(/`/g, '\\`')}\`}` };
|
||||
}
|
||||
return child;
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ export const DEFAULT_REMARK_PLUGINS = [
|
|||
'remark-gfm',
|
||||
'remark-footnotes',
|
||||
// TODO: reenable smartypants!
|
||||
'@silvenon/remark-smartypants'
|
||||
// '@silvenon/remark-smartypants'
|
||||
]
|
||||
|
||||
export const DEFAULT_REHYPE_PLUGINS = [
|
||||
|
|
|
@ -16,6 +16,8 @@ export default function rehypeJsx(): any {
|
|||
let attr = entry.value;
|
||||
if (attr && typeof attr === 'object') {
|
||||
attr = `{${attr.value}}`
|
||||
} else if (attr === null) {
|
||||
attr = `{true}`
|
||||
}
|
||||
return Object.assign(acc, { [entry.name]: attr });
|
||||
}, {})
|
||||
|
|
Loading…
Reference in a new issue