summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src/index.ts
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2022-07-23 17:23:15 -0500
committerGravatar GitHub <noreply@github.com> 2022-07-23 17:23:15 -0500
commit6e27a5fdc21276cad26cd50e16a2709a40a7cbac (patch)
tree65658fee080c5f8dfa06903cefc3d9736db6f409 /packages/markdown/remark/src/index.ts
parent1215e731b8a334fce364aca77bda1085f3679e57 (diff)
downloadastro-6e27a5fdc21276cad26cd50e16a2709a40a7cbac.tar.gz
astro-6e27a5fdc21276cad26cd50e16a2709a40a7cbac.tar.zst
astro-6e27a5fdc21276cad26cd50e16a2709a40a7cbac.zip
Rename Markdown util `getHeaders()` to `getHeadings()` (#4031)
* Renamed getHeaders() to getHeadings(), according to RFC #208. * chore: update changeset * fix: expose MarkdownHeading type from `astro` Co-authored-by: Félix Sanz <me@felixsanz.com> Co-authored-by: Nate Moore <nate@astro.build>
Diffstat (limited to 'packages/markdown/remark/src/index.ts')
-rw-r--r--packages/markdown/remark/src/index.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index 8748eff2b..4dfd7240f 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -1,7 +1,7 @@
import type { MarkdownRenderingOptions, MarkdownRenderingResult } from './types';
import { loadPlugins } from './load-plugins.js';
-import createCollectHeaders from './rehype-collect-headers.js';
+import createCollectHeadings from './rehype-collect-headings.js';
import rehypeEscape from './rehype-escape.js';
import rehypeExpressions from './rehype-expressions.js';
import rehypeIslands from './rehype-islands.js';
@@ -41,7 +41,7 @@ export async function renderMarkdown(
} = opts;
const input = new VFile({ value: content, path: fileURL });
const scopedClassName = opts.$?.scopedClassName;
- const { headers, rehypeCollectHeaders } = createCollectHeaders();
+ const { headings, rehypeCollectHeadings } = createCollectHeadings();
let parser = unified()
.use(markdown)
@@ -94,8 +94,8 @@ export async function renderMarkdown(
parser
.use(
isAstroFlavoredMd
- ? [rehypeJsx, rehypeExpressions, rehypeEscape, rehypeIslands, rehypeCollectHeaders]
- : [rehypeCollectHeaders, rehypeRaw]
+ ? [rehypeJsx, rehypeExpressions, rehypeEscape, rehypeIslands, rehypeCollectHeadings]
+ : [rehypeCollectHeadings, rehypeRaw]
)
.use(rehypeStringify, { allowDangerousHtml: true });
@@ -113,7 +113,7 @@ export async function renderMarkdown(
}
return {
- metadata: { headers, source: content, html: result.toString() },
+ metadata: { headings, source: content, html: result.toString() },
code: result.toString(),
};
}