summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r--packages/markdown/remark/src/index.ts5
-rw-r--r--packages/markdown/remark/src/rehype-collect-headings.ts2
-rw-r--r--packages/markdown/remark/src/remark-prism.ts1
-rw-r--r--packages/markdown/remark/src/remark-shiki.ts2
4 files changed, 4 insertions, 6 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index 0a21e1c98..aa02f8ea9 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -147,7 +147,7 @@ export async function renderMarkdown(
function prefixError(err: any, prefix: string) {
// If the error is an object with a `message` property, attempt to prefix the message
- if (err && err.message) {
+ if (err?.message) {
try {
err.message = `${prefix}:\n${err.message}`;
return err;
@@ -160,9 +160,8 @@ function prefixError(err: any, prefix: string) {
const wrappedError = new Error(`${prefix}${err ? `: ${err}` : ''}`);
try {
wrappedError.stack = err.stack;
- // @ts-expect-error
wrappedError.cause = err;
- } catch (error) {
+ } catch {
// It's ok if we could not set the stack or cause - the message is the most important part
}
diff --git a/packages/markdown/remark/src/rehype-collect-headings.ts b/packages/markdown/remark/src/rehype-collect-headings.ts
index 9e3c8005e..862400545 100644
--- a/packages/markdown/remark/src/rehype-collect-headings.ts
+++ b/packages/markdown/remark/src/rehype-collect-headings.ts
@@ -20,7 +20,7 @@ export function rehypeHeadingIds(): ReturnType<RehypePlugin> {
if (node.type !== 'element') return;
const { tagName } = node;
if (tagName[0] !== 'h') return;
- const [_, level] = tagName.match(/h([0-6])/) ?? [];
+ const [, level] = tagName.match(/h([0-6])/) ?? [];
if (!level) return;
const depth = Number.parseInt(level);
diff --git a/packages/markdown/remark/src/remark-prism.ts b/packages/markdown/remark/src/remark-prism.ts
index 80037a3e3..6147d9ee9 100644
--- a/packages/markdown/remark/src/remark-prism.ts
+++ b/packages/markdown/remark/src/remark-prism.ts
@@ -1,6 +1,5 @@
import { runHighlighterWithAstro } from '@astrojs/prism/dist/highlighter';
import { visit } from 'unist-util-visit';
-const noVisit = new Set(['root', 'html', 'text']);
type MaybeString = string | null | undefined;
diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts
index 8035635f9..28e362e34 100644
--- a/packages/markdown/remark/src/remark-shiki.ts
+++ b/packages/markdown/remark/src/remark-shiki.ts
@@ -80,7 +80,7 @@ const remarkShiki = async (
lang = 'plaintext';
}
- let html = highlighter!.codeToHtml(node.value, { lang });
+ let html = highlighter.codeToHtml(node.value, { lang });
// Q: Couldn't these regexes match on a user's inputted code blocks?
// A: Nope! All rendered HTML is properly escaped.