This commit is contained in:
parent
6e82102c1b
commit
d9289b88b2
2 changed files with 3 additions and 2 deletions
|
@ -94,6 +94,7 @@ const remarkAgda: RemarkPlugin = ({ base, publicDir }: Options) => {
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
<link rel="stylesheet" href="${base}generated/agda/Agda.css" />
|
<link rel="stylesheet" href="${base}generated/agda/Agda.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import getReadingTime from "reading-time";
|
import getReadingTime from "reading-time";
|
||||||
import { toString } from "mdast-util-to-string";
|
import { toString as mdastToString } from "mdast-util-to-string";
|
||||||
import type { RemarkPlugin } from "@astrojs/markdown-remark";
|
import type { RemarkPlugin } from "@astrojs/markdown-remark";
|
||||||
|
|
||||||
const remarkReadingTime: RemarkPlugin = () => {
|
const remarkReadingTime: RemarkPlugin = () => {
|
||||||
return (tree, { data }) => {
|
return (tree, { data }) => {
|
||||||
const textOnPage = toString(tree);
|
const textOnPage = mdastToString(tree);
|
||||||
const readingTime = getReadingTime(textOnPage);
|
const readingTime = getReadingTime(textOnPage);
|
||||||
|
|
||||||
// readingTime.text will give us minutes read as a friendly string,
|
// readingTime.text will give us minutes read as a friendly string,
|
||||||
|
|
Loading…
Reference in a new issue