1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 11:46:39 -04:00

allow markdown in mdx page titles (carefully)

mainly for `code` but also bold and italic text
This commit is contained in:
2022-01-04 13:49:07 -05:00
parent 6cde2944fc
commit b1bcdeb84b
5 changed files with 22 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import Link from "next/link";
import Markdown from "markdown-to-jsx";
import { format } from "date-fns";
import styles from "./List.module.scss";
@ -22,7 +23,9 @@ const List = ({ notesByYear }) => {
<span className={styles.date}>{format(new Date(note.date), "MMM d")}</span>
<span>
<Link href={`/notes/${note.slug}/`} prefetch={false}>
<a>{note.title}</a>
<a>
<Markdown options={{ disableParsingRawHTML: true, forceInline: true }}>{note.title}</Markdown>
</a>
</Link>
</span>
</li>

View File

@ -67,4 +67,12 @@
padding-bottom: 0;
color: inherit;
}
code {
font-size: 1em;
background: none !important;
border: 0 !important;
margin: 0 0.075em !important;
padding: 0 !important;
}
}

View File

@ -1,5 +1,6 @@
import Link from "next/link";
import { format } from "date-fns";
import Markdown from "markdown-to-jsx";
import Hits from "../hits/Hits";
import { DateIcon, TagIcon, EditIcon, ViewsIcon } from "../icons";
import * as config from "../../lib/config";
@ -61,7 +62,9 @@ const Meta = ({ title, date, slug, tags = [] }: Props) => (
<h1 className={styles.title}>
<Link href={`/notes/${slug}/`}>
<a>{title}</a>
<a>
<Markdown options={{ disableParsingRawHTML: true, forceInline: true }}>{title}</Markdown>
</a>
</Link>
</h1>
</>