[ci] format
This commit is contained in:
parent
c039ea93a1
commit
367cdd9ed8
5 changed files with 18 additions and 11 deletions
|
@ -22,7 +22,9 @@ describe('Astro Markdown - frontmatter injection', () => {
|
|||
|
||||
it('rehype supports custom vfile data - reading time', async () => {
|
||||
const frontmatterByPage = JSON.parse(await fixture.readFile('/glob.json'));
|
||||
const readingTimes = frontmatterByPage.map((frontmatter = {}) => frontmatter.injectedReadingTime);
|
||||
const readingTimes = frontmatterByPage.map(
|
||||
(frontmatter = {}) => frontmatter.injectedReadingTime
|
||||
);
|
||||
expect(readingTimes.length).to.be.greaterThan(0);
|
||||
for (let readingTime of readingTimes) {
|
||||
expect(readingTime).to.not.be.null;
|
||||
|
@ -32,7 +34,9 @@ describe('Astro Markdown - frontmatter injection', () => {
|
|||
|
||||
it('overrides injected frontmatter with user frontmatter', async () => {
|
||||
const frontmatterByPage = JSON.parse(await fixture.readFile('/glob.json'));
|
||||
const readingTimes = frontmatterByPage.map((frontmatter = {}) => frontmatter.injectedReadingTime?.text);
|
||||
const readingTimes = frontmatterByPage.map(
|
||||
(frontmatter = {}) => frontmatter.injectedReadingTime?.text
|
||||
);
|
||||
const titles = frontmatterByPage.map((frontmatter = {}) => frontmatter.title);
|
||||
expect(titles).to.contain('Overridden title');
|
||||
expect(readingTimes).to.contain('1000 min read');
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { name as isValidIdentifierName } from 'estree-util-is-identifier-name';
|
||||
import type { VFile } from 'vfile';
|
||||
import type { MdxjsEsm } from 'mdast-util-mdx';
|
||||
import type { MarkdownAstroData } from 'astro';
|
||||
import type { Data } from 'vfile';
|
||||
import { name as isValidIdentifierName } from 'estree-util-is-identifier-name';
|
||||
import type { MdxjsEsm } from 'mdast-util-mdx';
|
||||
import type { Data, VFile } from 'vfile';
|
||||
import { jsToTreeNode } from './utils.js';
|
||||
|
||||
export function remarkInitializeAstroData() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { compile as mdxCompile, nodeTypes } from '@mdx-js/mdx';
|
||||
import mdxPlugin, { Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
||||
import type { AstroIntegration, AstroConfig } from 'astro';
|
||||
import { remarkInitializeAstroData, rehypeApplyFrontmatterExport } from './astro-data-utils.js';
|
||||
import type { AstroConfig, AstroIntegration } from 'astro';
|
||||
import { parse as parseESM } from 'es-module-lexer';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
|
@ -10,6 +9,7 @@ import remarkShikiTwoslash from 'remark-shiki-twoslash';
|
|||
import remarkSmartypants from 'remark-smartypants';
|
||||
import { VFile } from 'vfile';
|
||||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import { rehypeApplyFrontmatterExport, remarkInitializeAstroData } from './astro-data-utils.js';
|
||||
import rehypeCollectHeadings from './rehype-collect-headings.js';
|
||||
import remarkPrism from './remark-prism.js';
|
||||
import { getFileInfo, parseFrontmatter } from './utils.js';
|
||||
|
|
|
@ -22,7 +22,9 @@ describe('MDX frontmatter injection', () => {
|
|||
|
||||
it('rehype supports custom vfile data - reading time', async () => {
|
||||
const frontmatterByPage = JSON.parse(await fixture.readFile('/glob.json'));
|
||||
const readingTimes = frontmatterByPage.map((frontmatter = {}) => frontmatter.injectedReadingTime);
|
||||
const readingTimes = frontmatterByPage.map(
|
||||
(frontmatter = {}) => frontmatter.injectedReadingTime
|
||||
);
|
||||
expect(readingTimes.length).to.be.greaterThan(0);
|
||||
for (let readingTime of readingTimes) {
|
||||
expect(readingTime).to.not.be.null;
|
||||
|
@ -32,7 +34,9 @@ describe('MDX frontmatter injection', () => {
|
|||
|
||||
it('overrides injected frontmatter with user frontmatter', async () => {
|
||||
const frontmatterByPage = JSON.parse(await fixture.readFile('/glob.json'));
|
||||
const readingTimes = frontmatterByPage.map((frontmatter = {}) => frontmatter.injectedReadingTime?.text);
|
||||
const readingTimes = frontmatterByPage.map(
|
||||
(frontmatter = {}) => frontmatter.injectedReadingTime?.text
|
||||
);
|
||||
const titles = frontmatterByPage.map((frontmatter = {}) => frontmatter.title);
|
||||
expect(titles).to.contain('Overridden title');
|
||||
expect(readingTimes).to.contain('1000 min read');
|
||||
|
|
|
@ -7,13 +7,13 @@ import rehypeExpressions from './rehype-expressions.js';
|
|||
import rehypeIslands from './rehype-islands.js';
|
||||
import rehypeJsx from './rehype-jsx.js';
|
||||
import remarkEscape from './remark-escape.js';
|
||||
import { remarkInitializeAstroData } from './remark-initialize-astro-data.js';
|
||||
import remarkMarkAndUnravel from './remark-mark-and-unravel.js';
|
||||
import remarkMdxish from './remark-mdxish.js';
|
||||
import remarkPrism from './remark-prism.js';
|
||||
import scopedStyles from './remark-scoped-styles.js';
|
||||
import remarkShiki from './remark-shiki.js';
|
||||
import remarkUnwrap from './remark-unwrap.js';
|
||||
import { remarkInitializeAstroData } from './remark-initialize-astro-data.js';
|
||||
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import rehypeStringify from 'rehype-stringify';
|
||||
|
|
Loading…
Reference in a new issue