summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-01-12fix shiki css class replace logic in md and mdx integrations (#5837)Gravatar Giuseppe La Torre 1-1/+1
2023-01-11[Content collections] Remove experimental flag (#5825)Gravatar Ben Holmes 1-3/+2
* refactor: remove experimental.cc from core * chore: remove experimental flag from tests * fix: mock contentDir in remark tests * fix: check vfile.path in rel-image-error plugin * fix: move .astro/ excludes to all test/fixtures * fix: include test/**/fixtures in ignore * chore: changeset
2023-01-06Add SmartyPants flag (#5769)Gravatar Ben Holmes 2-0/+5
* feat: add smartypants flag * test: smartypants in markdown and mdx * docs: Smartypants -> SmartyPants * chore: changeset * chore: update changeset with 1.0 -> 2.0 in mind * chore: bump to minor change
2023-01-03[ci] formatGravatar matthewp 1-1/+1
2023-01-03Markdown and MDX configuration rework (#5684)Gravatar Ben Holmes 2-69/+56
* feat: change extendDefaults -> gfm * deps: remove smartypants from md/remark * tests: update markdown plugin tests * fix: borked lockfile * feat: allow all Markdown options in MDX config, with extend * deps: remove smartypants from MDX * chore: remove unused `mode` property * chore: remark rehype types * chore: dead code * fix: order of default config properties * refactor: move md defaults to remark * fix: RemarkRehype type * fix: apply defaults based on MD defaults * chore: update plugin tests * chore: add syntaxHighlight test * refactor: remove drafts from config defaults * docs: new MDX config options * chore: add changeset * edit: test both extends for syntax highlight * refactor: remove MDX config deep merge * docs: update README and changeset * edit: avoid -> disable Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: `drafts` clarification Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: remove "scare quotes" Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * docs: MDX config options redraft * docs: add migration * chore: changeset heading levels * refactor: githubFlavoredMarkdown -> gfm * chore: remove unused imports Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2023-01-03[ci] formatGravatar bholmesdev 1-5/+5
2023-01-03Change frontmatter injection ordering (#5687)Gravatar Ben Holmes 2-67/+24
* feat: make user frontmatter accessible in md * test: new frontmatter injection * refactor: move injection utils to remark pkg * fix: add dist/internal to remark exports * feat: update frontmater injection in mdx * tests: new mdx injection * chore: changeset * chore: simplify frontmatter destructuring * fix: remove old _internal references * refactor: injectedFrontmatter -> remarkPluginFrontmatter * docs: add content collections change * chore: changeset heading levels
2022-12-22[ci] formatGravatar bholmesdev 1-1/+0
2022-12-22[MDX] Remove verbose migration logs (#5667)Gravatar Ben Holmes 2-42/+5
* chore: remove markdown extends warnings * chore: changeset
2022-12-22[ci] formatGravatar bholmesdev 1-4/+4
2022-12-22[Content] Throw on relative image usage (#5648)Gravatar Ben Holmes 2-1/+56
* chore: add rel image error plugin * deps: mdast, mdast types * chore: add rel image throw to mdx * refactor: doc rel image path plugin * fix: respect experimental flag in md remark * chore: changeset * deps: remove mdast package * fix: resolve contentDir from config * fix: apply MDX plugin after user plugins * fix: stub out contentDir
2022-12-20[ci] formatGravatar delucis 1-1/+1
2022-12-20MD/MDX collect headings refactor (#5654)Gravatar Chris Swithinbank 2-47/+14
2022-12-16Content Collections (#5291)Gravatar Ben Holmes 1-4/+8
* feat: port content plugin as-is * feat: add `fetchContent` to `.astro` * refactor: move more logic to content-internals * refactor: move internals -> content dir * feat: nested dir support * feat: add with-content playground * edit: update README * fix: serialize route pattern for Netlify edge Co-authored-by: Jackie Macharia <jackiewmacharia> * wip: add ?astro-asset-ssr flag * wip: exclude astro-ssr-asset styles from build * revert: SSR asset flag babel changes * feat: only load CSS when mdx is rendered! * fix(vercel): Include all files inside `dist/` instead of only `entry.mjs` (#5175) * chore: only-allow pnpm (#5131) * [MDX] Support `recmaPlugins` config (#5146) * feat: support recma plugins * chore: add `test:match` to MDX * chore: changeset * docs: add recmaPlugins to README * removes default content-visibility styles from image components (#5180) * wip: check renderContent works * nit: injectDelayedAssetPlugin doesn't need enforce * feat: render content with generated entries * feat: renderContent style injection POC * wip: scrappy renderContent binding * deps: parse-imports * feat: only bind renderContent when imported * feat: new-and-improved render-content * fix: update example to use render-content * refactor: extract normalizeFilename helper * feat: move renderContent to `.astro` * feat: add `getStaticPaths` demo 👀 * chore: remove console log * refactor: internals -> internal * fix: style bleed on dynamic routes * chore: remove console log * refactor: move rendercontentmap inside same file * fix: style bleed in dev! * feat: clean up example * refactor: curry generateContent * nit: add datetime demo * refactor: rename and move content plugins * feat: granular content updates in development * chore: console.log * refactor: move write logic, fix edge cases * fix: use z.any() when ~schema is missing * refactor: clean up logging * fix: add delayed asset flag to render map * fix: use new server loader * chore: import type * fix: split delayed assets to separate chunks * chore: bad merge changesets * feat: rework content map to Vite globs * fix: formatted errors * fix: get `renderContent` working with new APIs * refactor: rename to getCollection, getEntry, renderEntry * feat: streamline type alias! * fix: check schema import is an import * refactor: change ~schema -> index with defineCollection * feat: auto apply env.d.ts reference * feat: expose `headings` on `renderEntry` * refactor: expose zod from astro/zod * feat: add Collection util type * refactor: generated types in src/content/ * edit: remove env.d.ts change from with-content * feat: collectionToPaths utility * refactor: migrate `examples/blog` * refactor: simplify [...slug] * fix: invalid date * fix: renderEntry * feat: migrate examples/docs to content! * refactor: union -> enum * fix: remove duplicate header * chore: changeset * Revert "fix: serialize route pattern for Netlify edge" This reverts commit ac46a0d3238af1e6f8c3b8f235163385be1ff732. * fix: lint * fix: include zod in package files * chore: push type gen for astro check * feat: move to single defineCollections file * feat: move examples to new collections model * chore: type check valid collection names * fix: ignore collections path in err logs * refactor: content/index -> content/config * refactor: defineCollections -> defineCollection * fix: update docs to defineCollection * chore: update with-content to new `astro:content` setup * fix: renderEntry styles * fix: bad Collection type * fix: blog types generated * feat: expose injectedFrontmatter on renderEntry * chore: `import type` * chore: add MDX to changeset * fix: template package file * fix: unneeded log on content config change * chore: add `injectedFrontmatter` to generated types * fix: escape import.meta.env in `body` * fix: escape import.meta.env in frontmatter * chore: unused import * fix: use URL for config pathname * feat: allow zod async transforms * deps: devalue * feat: custom slugs + better type checking * fix: update types on config added or removed * chore: add error msg for MDX preview release * refactor: restore old normalizeFilename * fix: add loadContentConfig error classes back * Add initial tests for renderEntry * add fixture tests * Use head propagation APIs in renderEntry * chore: new type gen * fix: sort content keys before writing * fix: avoid writing '.' collection with warning * chore: docs types generated * fix: generated types only once in build * fix: use relative path to config for git * chore: update generated types * fix: glob pattern on valid exts * feat: warn on possible collection typos * chore: better error on bad lazy import * fix: clear gray-matter cache for rawData * fix: wait for config file while generating * test: get collection and get entry basic * test: multiple collections and entries * test: add publishedDate test on entry * tests: getStaticPaths integration * test: ssr endpoint integration * chore: consistent test names * refactor: simplify generates... test * chore: tests lockfile * feat: add `experimental` flag * chore: revert blog and docs examples * chore: add experimental flag to with-content * refactor: reuse contentFileExts * refactor: make contentCollectionCss required * chore: remove parse-imports dependency * chore: remove unresolved idea redundancy * chore: update changeset to minor v * chore: clean up with-content pass 1 * refactor: de-monolith vite-plugin-content * chore: remove maximum jank warning (it's acceptable jank) * refactor: extract types-generator to separate file * refactor: onEvent -> handleEvent * edit: change content log to "types generated" * fix: more experimental checks in prod build * refactor: 2 jsToTreeNode calls -> 1 * feat: change with-content example to blog example * fix: Content component type * Fix use of renderEntry within a slot * fix: warn for non-underscore _ files, refine logs * chore: Content type in tests * fix: types no updating with config changes * fix: remove `result: SSRResult` type * chore: entry var shadowing * fix: bad experimental flag call * wip: skip render entry tests * fix: path resolution for .relative on windows * chore: remove dead code * wip: log entryPath into * fix: use URL for entry * refactor: getEntryInfo normalization * refactor: move debounce to queueEvent only * fix: resolve loader on config error * fix: pathToFileURL -> new URL * fix: dangerous pathname comparison * refactor: move rawEvent -> event mapping to queueEvent * fix: bad type * wip: remove mkdir call * wip: log content paths * fix: more bad paths * wip: more logs * fix: correct glob path * fix: normalize virtual mod path * fix: content server file paths * chore: remove render entry test skip * wip: skip renderEntry tests (windows issues?) * chore: remove console log * feat: renderEntry -> render * chore: add `--experimental-content-collections` * refactor: only skip renderEntry tests on windows * refactor: index.ts barrel export * fix: cli type error * fix: proper test skip on windows * refactor: remove collectionToPaths :( * refactor: use AstroError for frontmatter error * nit: its schema, .* * fix: bad isWindows import * fix: await mod -> mod = await Co-authored-by: Juan Martín Seery <me@juanm04.com> Co-authored-by: 花果山大圣 <316783812@qq.com> Co-authored-by: Tony Sullivan <tony.f.sullivan@outlook.com> Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: bholmesdev <bholmesdev@gmail.com>
2022-12-05Support rendering `<Fragment>` in MDX `<Content />` component (#5522)Gravatar Chris Swithinbank 1-6/+23
2022-11-22[ci] formatGravatar matthewp 1-1/+1
2022-11-22[MDX] Support remark-rehype options from Astro Markdown config (#5427)Gravatar Thomas Jaggi 1-0/+12
* [MDX] Support remark-rehype options from Astro Markdown config * [MDX] Add remarkRehype to MdxOptions, extend with default markdown config * [MDX] Add remarkRehype to README * [MDX] Fix remarkRehype inheritance, add tests * [MDX] Update remarkRehype docs in README Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * [MDX] Fix remarkRehype docs Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-11-09Preserve code element node meta for rehype syntax highlighters (#5335)Gravatar Bjorn Lu 2-0/+20
2022-10-26feat: add support for other markdown file extensions (#5164)Gravatar Happydev 1-1/+1
* fix: add `.markdown ` file extension support adds `.markdown` file extension support for markdown files * test: add test case * chore: adds changeset * test: move test and fixture to relevant locations * test: update test * feat: add multiple markdown file extension support * feat: add module declaration for different markdown file extensions * refactor: markdown module declarations for ease of TS refactoring * fix: add .js extension to module imports * test: update test * chore: update changeset * chore: update changeset * test: add new test cases * test: update tests * fix: correct typo
2022-10-24[MDX] Support `recmaPlugins` config (#5146)Gravatar Ben Holmes 1-1/+6
* feat: support recma plugins * chore: add `test:match` to MDX * chore: changeset * docs: add recmaPlugins to README
2022-10-03Suppress eslint warnings (#4953)Gravatar Bjorn Lu 1-3/+3
2022-09-26[ci] formatGravatar bholmesdev 2-13/+13
2022-09-26Fix: correctly transform `import.meta.env.*` in MDX (#4858)Gravatar Ben Holmes 4-232/+316
* fix: serialize route pattern for Netlify edge Co-authored-by: Jackie Macharia <jackiewmacharia> * fix: escape import.meta.env in MDX compiler output * test: env vars in mdx * chore: changeset * deps: estree-util-visit, @types/estree * feat: inject import.meta.env w/ recma * feat: pull importMetaEnv from vite + astro configs * test: `import.meta.env` in JSX * fix: lockfile * chore: update changeset * fix: remove stray stashed commit
2022-09-01[MDX] Fix: GFM and Smartypants missing by default (#4588)Gravatar Ben Holmes 1-2/+9
* fix: apply Astro defaults on empty md config * chore: changeset
2022-08-30[ci] formatGravatar bholmesdev 2-10/+10
2022-08-30[MDX] Extend Markdown plugin config, with customization options (#4504)Gravatar Ben Holmes 2-64/+157
* test: new combined remark / rehype suite * fix: use with-plugins fixture * chore: remove old mdx plugin tests * docs: add JS docs * docs: update README with thorough example * chore: changeset * fix: add "extends" error message * fix: ignore string-based plugins in md * feat: add warning log for string plugins * docs: highlight `extendPlugins` Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * nit: highlight "extendPlugins" * fix: md plugins type check * chore: "defaults" -> "astroDefaults" * nit: info log when inheriting markdown plugins * refactor: one big log on new behavior * dan: dan nit Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-08-28chore: updated shiki (#4519)Gravatar Juan Martín Seery 1-6/+16
* Upgraded shiki * Use setColorReplacements * no-shadow * Changeset
2022-08-25Update Markdown type signature to match behavior (#4423)Gravatar Ben Holmes 1-0/+2
* feat: "file" and "url" top-level layout props * test: markdown file and url * test: mdx file and url * feat: update MarkdownInstance + JSDoc improvements * chore: changeset
2022-08-23Fix MDX style imports when layout is not applied (#4443)Gravatar Ben Holmes 1-0/+5
* fix: add "astro.needsHeadRendering" to MDX * test: style imports in pages without layout * chore: changeset
2022-08-22Improve MDX glob perf - move Layout to async import (#4428)Gravatar Ben Holmes 1-2/+6
* fix: move layout to async import * chore: changeset * docs: clarify async import
2022-08-15[MDX] Switch from Shiki Twoslash -> Astro Markdown highlighter (#4292)Gravatar Ben Holmes 2-15/+95
* freat: twoslash -> Astro shiki parser * test: update shiki style check * feat: always apply rehypeRaw * deps: move remark-shiki-twoslash to dev * test: add shiki-twoslash test * docs: update readme with twoslash example * chore: changeset * nit: remove "describe('disabled')"
2022-08-12[MDX] Fix remaining inconsistencies with Markdown (#4268)Gravatar Ben Holmes 2-0/+21
* feat: add "file" and "url" to layout props * feat: add rawContent and compiledContent errs * fix: add "file" and "url" to frontmatter * fix: add separate MDX instance type * types: add MarkdownLayoutProps and MDXLayoutProps * refactor: simplify MDXLayoutProps * test: pass file and url to layout * test: glob components with .default and Content * feat: add <Content /> to MDX * feat: declare MDX type module * fix: [MD] move file and url to layout props only * chore: changeset * chore: bump MDX to "minor" with more details * refactor: remove "file" + "url" top-level props (save for minor) * revert: MDInstance type def updates (save for minor) * fix: MDXInstance "default" + "content" types * fix: bad test layout * chore: remove getHeaders fro *.mdx
2022-08-11[MDX] Pass injected frontmatter to layouts (#4255)Gravatar Ben Holmes 2-10/+37
* fix: move layout generation to remark plugin * test: frontmatter injection in layout * chore: changeset * fix: remove content fallback
2022-08-10Mdx/plugin unshift (#4248)astro@1.0.2@astrojs/preact@1.0.1@astrojs/mdx@0.8.2@astrojs/cloudflare@1.0.1Gravatar Jakob Helgesson 1-2/+2
* Add builtin rehype plugin to beginning * Add Changeset * Do the same to rehypeRaw for consistency
2022-08-08[ci] formatGravatar natemoo-re 1-1/+3
2022-08-08[MDX] Remove `frontmatterOptions` (#4204)Gravatar Ben Holmes 2-40/+5
* feat: remove frontmatterOptions config * test: remove custom frontmatter suite * deps: remove remark-mdx-frontmatter * docs: remove `frontmatterOptions` config * chore: changeset
2022-08-05[MDX] Prevent overriding `collect-headings` plugin (#4181)Gravatar Ben Holmes 1-2/+7
* fix: make rehypeCollectHeadings a required plugin * docs: update README on rehypePlugins * test: remove collect-headings override test * docs: remove extends from rehype docs * chore: changeset
2022-08-05[ci] formatGravatar natemoo-re 2-5/+4
2022-08-05Frontmatter injection for MD and MDX (#4176)Gravatar Ben Holmes 3-52/+144
* feat: inject vfile data as exports * feat: add vfile to renderMarkdown output * feat: add safe astroExports parser to utils * refactor: expose vite-plugin-utils on astro package * feat: handle astroExports in mdx * deps: vfile * chore: lockfile * test: astroExports in mdx * refactor: merge plugin exports into forntmatter * refactor: astroExports -> astro.frontmatter * refactor: md astroExports -> astro.frontmatter * feat: astro.frontmatter vite-plugin-markdown * chore: remove unused import * fix: inline safelyGetAstroData in MDX integration * chore: check that frontmatter export is valid export name * chore: error log naming * test: mdx remark frontmatter injection * fix: inconsistent shiki mod resolution * fix: add new frontmatter and heading props * test: remark vdata * fix: spread astro.data.frontmatter * test deps: mdast-util-to-string, reading-time * fix: astro-md test package name * test: md frontmatter injection * fix: layouts * deps: remove vite-plugin-utils export * fix: package lock * chore: remove dup import * chore: changeset * chore: add comment on safelyGetAstroData source * deps: move mdast-util-to-string + reading-time to test fixture * chore: move remark plugins to test fixture * fix: override plugin frontmatter with user frontmatter * test: md injected frontmatter overrides * test: frontmatter injection overrides mdx
2022-08-04fix missing newline bug in mdx (#4145)Gravatar Fred K. Schott 1-1/+1
2022-08-03[MDX] Add `headings` and `frontmatter` to layout props (#4134)Gravatar Ben Holmes 1-2/+2
* feat: expose headings on layout props * test: frontmatter AND content * test: headings in layouts * chore: changeset
2022-08-02Refactor @astrojs/prism, fix Prism component import not working (#4114)Gravatar Erika 1-44/+2
* Upgrade @astrojs/prism to a real package, fix component import not working * Remove `@astrojs/prism` as a dependency of `astro` * Update lock file * Refactor to multiple files * Oops, can't have astro imports run inside node * Follow Nate's suggestion on being minors instead of patchs * Update lockfile
2022-08-02Add generic plugin for `page-ssr` injection (#4049)Gravatar Nate Moore 1-7/+0
* feat: add generic page-ssr plugin * refactor: remove page-specific logic from astro/markdown/mdx plugins * refactor: revert changes to vite-plugin-scripts * fix: handle injected `page` scripts in build * fix: prepend injected `page` scripts with `/@id/` in dev Co-authored-by: Nate Moore <nate@astro.build>
2022-08-02Load configs with Vite when loading with Proload fails (#4112)Gravatar Matthew Phillips 1-1/+1
* 4078 breaking test * Use Vite for loading the config * Try it * Fallback to loading with Vite only when needed * Remove console.error * Remove extra console.log * Add a changeset * Use middlewareMode
2022-08-01[ci] formatGravatar bholmesdev 2-5/+5
2022-08-01[MDX] Add `getHeadings` + generate anchor links (#4095)Gravatar Ben Holmes 3-22/+109
* deps: mdx github-slugger * feat: add getHeadings via rehype plugin * chore: stray console.log * test: getHeadings w/ & w/0 JSX expressions * docs: add generated exports * refactor: pass headings using vfile.data * deps: vfile * test: heading anchor IDs * docs: add collect-headings to default rehype plugins * chore: changeset * deps: estree-util-value-to-estree * refactor: inject getHeadings export the right way! * deps: switch to acorn * refactor: just use acorn * docs: `getHeadings` info structuring Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * docs: clarify `url` example Co-authored-by: Chris Swithinbank <swithinbank@gmail.com> * fix: move slugger inside plugin call * refactor: cleanup code reassignment * chore: lint * deps: mdast-util-mdx, test utils * refactor: add jsToTreeNode util * feat: expose utils for lib authors * test: rehype plugins w/ and w/o extends * test: fixture * refactor: remove utils from package exports Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2022-07-29[ci] formatGravatar bholmesdev 2-9/+9
2022-07-29feat: support `layout` in MDX frontmatter (#4088)Gravatar Ben Holmes 2-13/+58
* deps: add gray-matter * feat: support layout frontmatter property * test: frontmatter, content prop * docs: update layout recommendation * deps: fix lockfile * chore: changeset * fix: inherit rollup plugin transform * fix: avoid parsing frontmatter on custom parsers * fix: match YAML err handling from md * docs: absolute url to docs Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * chore: formatting Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-07-28[ci] formatGravatar matthewp 1-2/+2
2022-07-28Ensure file and url are always present in MDX for Astro.glob (#4076)Gravatar Matthew Phillips 2-5/+27