Commit graph

163 commits

Author SHA1 Message Date
Ben Holmes
f7afdb889f
[MDX] Fix remaining inconsistencies with Markdown (#4268)
* 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-12 18:17:26 -04:00
natemoo-re
437bf73f26 [ci] format 2022-08-12 22:03:24 +00:00
Nate Moore
24d2f7a6e6
Fix namespaced component usage in MDX (#4272)
* fix(#4209): handle namespaced JSX and MDX

* chore: add changeset

* chore: update lockfile

* fix: throw error when componentExport is unresolved

* chore: bump compiler

* chore: bump compiler

* chore: revert example changes

Co-authored-by: Nate Moore <nate@astro.build>
2022-08-12 17:01:05 -05:00
Fred K. Bot
bb3d7d4f39
[ci] release (#4249)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-11 16:50:59 -07:00
Ben Holmes
4116128082
[MDX] Pass injected frontmatter to layouts (#4255)
* fix: move layout generation to remark plugin

* test: frontmatter injection in layout

* chore: changeset

* fix: remove content fallback
2022-08-11 12:36:34 -05:00
Jakob Helgesson
869d009359
Mdx/plugin unshift (#4248)
* Add builtin rehype plugin to beginning

* Add Changeset

* Do the same to rehypeRaw for consistency
2022-08-10 17:10:06 -04:00
Fred K. Bot
1ee08baf91
[ci] release (#4228)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-10 16:54:12 -04:00
Ben Holmes
9d5ab55086
[MDX] Astro.props.content -> frontmatter (#4237)
* docs: MDX Astro.props.content -> frontmatter

* chore: changeset
2022-08-10 15:43:35 -04:00
Nate Moore
9f067dca27
Astro 1.0.0 (#4214)
* chore: remove changesets patch

* chore: add changesets

* chore: version packages

* chore: normalize formatting

* chore: update lockfile

* chore: fix codeblocks

* Update packages/astro/CHANGELOG.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/CHANGELOG.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/CHANGELOG.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* chore: fixup code samples

* chore: move v0.25 message out of note

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-08-09 11:10:25 -05:00
Sarah Rainsberger
63d43e1754
remove errant remaining details tags (#4212) 2022-08-09 09:09:16 -05:00
Fred K. Bot
4d29163d11
[ci] release (#4197)
* [ci] release

* Update CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-08-08 18:10:55 -05:00
natemoo-re
7eb54fcb4f [ci] format 2022-08-08 22:35:40 +00:00
Ben Holmes
4c2ca5352d
[MDX] Remove frontmatterOptions (#4204)
* feat: remove frontmatterOptions config

* test: remove custom frontmatter suite

* deps: remove remark-mdx-frontmatter

* docs: remove `frontmatterOptions` config

* chore: changeset
2022-08-08 17:33:35 -05:00
Ben Holmes
6c9736cbc9
[MDX] Add frontmatter injection to README (#4205)
* docs: remove `remark-mdx-frontmatter` from README

* docs: remove remark-mdx-frontmatter link

* docs: MDX frontmatter injection

* chore: changeset
2022-08-08 17:16:06 -04:00
Sarah Rainsberger
9894b3dcde
remove details tags from integration READMEs (#4198) 2022-08-08 12:07:38 -05:00
Fred K. Bot
4e4061f485
[ci] release (#4159)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-05 21:48:35 -07:00
Ben Holmes
77cede720b
[MDX] Prevent overriding collect-headings plugin (#4181)
* 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 20:51:38 -07:00
natemoo-re
367cdd9ed8 [ci] format 2022-08-05 23:58:09 +00:00
Ben Holmes
2675b8633c
Frontmatter injection for MD and MDX (#4176)
* 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-05 18:55:38 -05:00
Matthew Phillips
8eb3a8c6d9
Add test for mdx + React usage (#4174)
* Add test for mdx + React usage

* Add a changeset

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-08-05 17:13:30 -04:00
Nate Moore
e569f0a5c7
Handle edge case in jsx-runtime (#4158)
* fix(#4135): handle edge case in jsx-runtime

* test: add mdx test case

* chore: fix utils reference

* test: fix mdx escape test

Co-authored-by: Nate Moore <nate@astro.build>
2022-08-05 10:35:47 -05:00
Fred K. Schott
c7efcf57e0
fix missing newline bug in mdx (#4145) 2022-08-04 23:12:07 -07:00
Fred K. Bot
7300f094fd
[ci] release (#4133)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-03 23:14:04 -07:00
bholmesdev
66319cb49f [ci] format 2022-08-03 21:56:30 +00:00
Ben Holmes
2968ba2b6f
[MDX] Add headings and frontmatter to layout props (#4134)
* feat: expose headings on layout props

* test: frontmatter AND content

* test: headings in layouts

* chore: changeset
2022-08-03 17:54:55 -04:00
Zade Viggers
a28b441763
Remove renderer tag to fix a docs issue (#4127)
[This page](https://docs.astro.build/en/guides/integrations-guide/) is autogenerated based on the packages in this repo and said packages' tags. Removing the renderer tag here should stop it from appearing in the UI Framework category.
2022-08-03 10:36:38 -05:00
Fred K. Bot
077d78fddc
[ci] release (#4116)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-08-02 14:50:21 -07:00
Erika
64432bcb87
Refactor @astrojs/prism, fix Prism component import not working (#4114)
* 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-02 15:53:18 -04:00
Nate Moore
b60cc0538b
Add generic plugin for page-ssr injection (#4049)
* 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-02 14:07:17 -05:00
matthewp
7d1f86d4b7 [ci] format 2022-08-02 12:10:35 +00:00
Matthew Phillips
e33fc9bc46
Load configs with Vite when loading with Proload fails (#4112)
* 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-02 08:08:28 -04:00
bholmesdev
10a8fa5dcd [ci] format 2022-08-01 21:25:50 +00:00
Ben Holmes
40ef43a59b
[MDX] Add getHeadings + generate anchor links (#4095)
* 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-08-01 17:23:56 -04:00
Fred K. Bot
268d44e25b
[ci] release (#4086)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-30 00:29:04 -04:00
bholmesdev
8e20156638 [ci] format 2022-07-29 15:24:57 +00:00
Ben Holmes
1743fe140e
feat: support layout in MDX frontmatter (#4088)
* 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-29 11:22:57 -04:00
Fred K. Bot
84193e3ea1
[ci] release (#4081)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-28 15:53:57 -04:00
matthewp
22f76b8a7e [ci] format 2022-07-28 15:00:32 +00:00
Matthew Phillips
6120a71e54
Ensure file and url are always present in MDX for Astro.glob (#4076) 2022-07-28 10:58:44 -04:00
Sarah Rainsberger
6fb95dbdd6
[docs content] MDX layouts (#4077) 2022-07-28 10:06:23 -03:00
Fred K. Bot
d790eabd98
[ci] release (#3972)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-26 09:58:38 -04:00
Fred K. Schott
9ab66c4ba9
add support for injected page-ssr scripts (#4050) 2022-07-26 00:26:47 -04:00
bholmesdev
c2968b0542 [ci] format 2022-07-21 20:46:16 +00:00
Ben Holmes
3b8a744524
[MDX] Add Prism and Shiki support (#4002)
* deps: add rehype-prism, shiki, rehype-pretty-code

* wip: apply rehype plugins depending on config

* wip: cherry-pick jsx-runtime fix?

* deps: rehype-pretty-code -> shiki-twoslash, add rehype-raw

* wip: add jsx-runtime fix

* feat: get shiki working!

* deps: add @astrojs/prism, prismjs, unist-util-visit

* feat: add prism support

* example: add small syntax highlight demo to with-mdx

* deps: remove rehype-prism

* chore: remove unused async

* chore: add .test.js to all mdx tests

* test: shiki, shikiConfig, prism

* fix: remove "is:raw" from prism output

* docs: add syntax highlighting section

* chore: add changeset

* nit: "Shiki config" -> Shiki config

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Revert "wip: add jsx-runtime fix"

This reverts commit 07f4528f44.

* docs: link to integration README from example

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2022-07-21 16:43:58 -04:00
bholmesdev
29eef85ce5 [ci] format 2022-07-21 01:36:26 +00:00
Ben Holmes
b2b367c969
[MDX] Support YAML frontmatter (#3995)
* chore: remove old comment

* deps: add remark-frontmatter

* deps: add remark-mdx-frontmatter

* fix: handle null or undefined frontmatter key

* feat: configure frontmatter plugins with defaults

* test: frontmatter and custom frontmatter name

* docs: add frontmatterOptions config

* docs: add "variables" and "frontmatter" docs

* chore: excessible -> accessible

* chore: changeset

* chore: remove bad mdx comment
2022-07-20 21:34:21 -04:00
bholmesdev
74b0099cd1 [ci] format 2022-07-20 18:16:33 +00:00
Ben Holmes
19433eb4a4
[MDX] Support remark and rehype plugins, with defaults (#3977)
* feaet: allow remark and rehype plugin config

* deps: add remark-gfm, remark-smartypants

* feat: add gfm and smartypants by default

* test: add GFM and remark plugin tests

* feat: preserve default plugins with "extends"

* docs: add remarkPlugins

* docs: add rehypePlugins

* chore: changeset

* fix: remove skip from mdx tests

* chore: dup hyperlink flavor text

* chore: authGen -> autoGen

* nit: markdown -> Markdown

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* nit: markdown -> Markdown 1

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* nit: markdown -> Markdown 2

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* nit: markdown -> Markdown 3

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

* nit: markdown -> Markdown 4

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2022-07-20 14:14:23 -04:00
bholmesdev
66012e334a [ci] format 2022-07-20 14:58:33 +00:00
Ben Holmes
61fec63044
[MDX] Include url in glob result (#3981)
* deps: add es-module-lexer

* feat: inject url export on mdx files

* fix: apply url transform in prod

* test: page urls with overrides

* fix: revert test skips

* chore: changeset

* fix: add newline before export
2022-07-20 10:56:32 -04:00
Fred K. Bot
37534004f0
[ci] release (#3939)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-18 21:54:25 -07:00
Chris Swithinbank
31f9c0bf02
Roll back supported Node engines (#3937)
Fixes #3936
2022-07-15 08:15:04 -04:00
Fred K. Bot
056d4d5fd2
[ci] release (#3903)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-13 17:16:24 -04:00
Randall
b487679853
Rollback Nodejs Dependancy (#3914)
* Rollback Nodejs Dependancy

Closes #3908

Signed-off-by: Randall T. Vasquez <ran.dall@icloud.com>

* Create ninety-apes-talk.md
2022-07-13 17:06:37 -04:00
Fred K. Bot
c2b14d5253
[ci] release (#3894)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-12 09:08:15 -04:00
Chris Swithinbank
bf5d1cc1e7
More integration README fixes (#3885)
* Integration README fixes

* More tweaks (mostly code backticks for filenames)

* Update changeset

* Few more tweaks

* Make sure code blocks all have a code language

* Use URLs of new docs pages for package homepage

* One more stray `<br>` 👢

* Standardise to `sh` instead of `shell`
2022-07-11 21:10:34 +02:00
Fred K. Bot
1554a37622
[ci] release (#3887)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-11 13:38:42 -05:00
Nate Moore
1cc5b78905
fix(#3071): update supported node versions (#3871)
Co-authored-by: Nate Moore <nate@astro.build>
2022-07-11 11:32:53 -05:00
Fred K. Bot
1785e568a0
[ci] release (#3850)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-08 20:54:39 -04:00
Ben Holmes
b012ee55b1
[astro add] Support adapters and third party packages (#3854)
* feat: support adapters and third part integrations by keywords

* refactor: add keywords to all official integrations

* docs: add adapter ex to astro add help

* nit: clarify astro add usage

* nit: highlight link

* fix: use process.exit(1) on error

* chore: changeset

* nit: bold integration name

* fix: log install instructions for adapters instead

* nit: change to logAdapterConfigInstructions

* Revert "fix: log install instructions for adapters instead"

This reverts commit 1a459f152b.

* feat: add hardcoded adapter export map

* refactor: inline adapter config log
2022-07-08 16:55:33 -04:00
Fred K. Bot
d07ad8a782
[ci] release (#3774)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-06-30 11:39:44 -07:00
natemoo-re
af23bdd515 [ci] format 2022-06-30 18:11:12 +00:00
Nate Moore
032ad1c047
MDX support (#3706)
* feat: first pass at MDX support

* fix: move built-in JSX renderer to come first

* chore: remove jsx example

* chore: update lockfile

* chore: cleanup example

* fix: missing deps

* refactor: move component render logic to `renderPage`

* chore: update HMR script

* chore: update MDX example

* refactor: prefer unshit

* refactor: remove TODO comment

* fix: remove duplicate identifier

* refactor: cleanup mdx entrypoint

* fix: better html handling

* fix: add tsconfig to mdx package

* chore: update lockfile

* fix: do not sort plugins unless mdx is enabled

* chore: update compiler

* fix(hmr): maybe render head for non-Astro pages

* fix: set initial pageExtensions

* refactor: cleanup addPageExtension

* refactor: remove addPageExtensions from types

* refactor: expose HookParameters type

* fix: only default to astro for MDX

* test: pick up jsx support in test fixtures

* refactor: simplify mdx entrypoint

* test: add basic MDX tests

* test(e2e): add mdx + framework tests

* chore: update lockfile

* test(e2e): fix preact mdx e2e test

* fix(mdx): disable .md support

* test(e2e): fix vue-component test missing mdx

* test(e2e): fix solid component needing import

* fix: allow `client:only="solid"` as an alias to `solid-js`

* chore: move to with-mdx example

* chore: update MDX readme

* chore: update example readme

* chore: bump astro version

* chore: update lockfile

* Update mod.d.ts

* feat: support `export const components` in MDX pages

* chore: update mdx example

* fix: update jsx-runtime with better slot support

* refactor: remove object style support

* chore: cleanup package exports

* chore: add todo comment

* refactor: improve isPage function, move to utils

* refactor: dry up manual HMR updates

* chore: add dev tests for MDX

* chore: prefer set to array

* chore: add changesets

* fix(hmr): flip public/private route

Co-authored-by: Nate Moore <nate@astro.build>
2022-06-30 13:09:09 -05:00