Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored and astrobot-houston committed Aug 5, 2022
1 parent c039ea9 commit 367cdd9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down
5 changes: 2 additions & 3 deletions packages/integrations/mdx/src/astro-data-utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { MarkdownAstroData } from 'astro';
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 type { Data, VFile } from 'vfile';
import { jsToTreeNode } from './utils.js';

export function remarkInitializeAstroData() {
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/mdx/src/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown/remark/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 367cdd9

Please sign in to comment.