1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-04-17 09:28:43 -04:00

update markdown-in-titles parsing

This commit is contained in:
2022-01-12 10:43:21 -05:00
parent e9dfe51863
commit c9f00d567a
4 changed files with 20 additions and 11 deletions

View File

@@ -6,7 +6,7 @@ type Props = {
slug: string;
};
const Comments = (props: Props) => {
const Comments = ({ slug }: Props) => {
const [injected, setInjected] = useState(false);
const scriptRef = useRef<HTMLDivElement>(null);
const { resolvedTheme } = useTheme();
@@ -26,7 +26,7 @@ const Comments = (props: Props) => {
// https://utteranc.es/
utterances.setAttribute("repo", githubRepo);
utterances.setAttribute("issue-term", `notes/${props.slug}`);
utterances.setAttribute("issue-term", `Comments on /notes/${slug}`);
utterances.setAttribute("theme", resolvedTheme === "dark" ? "github-dark" : "github-light");
utterances.setAttribute("label", "💬 comments");

View File

@@ -12,18 +12,18 @@ const List = ({ notesByYear }) => {
<section key={year} className={styles.section}>
<h2 className={styles.year}>{year}</h2>
<ul className={styles.list}>
{notes.map((note) => (
<li key={note.slug} className={styles.row}>
<span className={styles.date}>{format(new Date(note.date), "MMM d")}</span>
{notes.map(({ slug, date, title, htmlTitle = "" }) => (
<li key={slug} className={styles.row}>
<span className={styles.date}>{format(new Date(date), "MMM d")}</span>
<span>
<Link
href={{
pathname: "/notes/[slug]/",
query: { slug: note.slug },
query: { slug: slug },
}}
prefetch={false}
>
<a dangerouslySetInnerHTML={{ __html: note.htmlTitle }} />
<a dangerouslySetInnerHTML={{ __html: htmlTitle || title }} />
</Link>
</span>
</li>

View File

@@ -7,7 +7,7 @@ import type { NoteMetaType } from "../../types";
import styles from "./Meta.module.css";
const Meta = ({ title, htmlTitle, date, slug, tags = [] }: NoteMetaType) => (
const Meta = ({ slug, date, title, htmlTitle = "", tags = [] }: NoteMetaType) => (
<>
<div className={styles.meta}>
<div className={styles.date}>
@@ -55,7 +55,7 @@ const Meta = ({ title, htmlTitle, date, slug, tags = [] }: NoteMetaType) => (
<h1 className={styles.title}>
<Link href={`/notes/${slug}/`}>
<a dangerouslySetInnerHTML={{ __html: htmlTitle }} />
<a dangerouslySetInnerHTML={{ __html: htmlTitle || title }} />
</Link>
</h1>
</>