diff --git a/.changeset/lemon-owls-end.md b/.changeset/lemon-owls-end.md new file mode 100644 index 000000000000..67a221874219 --- /dev/null +++ b/.changeset/lemon-owls-end.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Improves Markdown options documentation with links to the Markdown guide and official processors. diff --git a/packages/astro/src/content/loaders/file.ts b/packages/astro/src/content/loaders/file.ts index cfb71f01b207..5456cb08c450 100644 --- a/packages/astro/src/content/loaders/file.ts +++ b/packages/astro/src/content/loaders/file.ts @@ -1,6 +1,6 @@ import { existsSync, promises as fs } from 'node:fs'; import { fileURLToPath } from 'node:url'; -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; import * as toml from 'smol-toml'; import { FileGlobNotSupported, FileParserNotFound } from '../../core/errors/errors-data.js'; import { AstroError } from '../../core/errors/index.js'; diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts index a9a9fe5eb941..773c9d01c336 100644 --- a/packages/astro/src/core/config/settings.ts +++ b/packages/astro/src/core/config/settings.ts @@ -1,6 +1,6 @@ import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; import * as toml from 'smol-toml'; import { getContentPaths } from '../../content/index.js'; import createPreferences from '../../preferences/index.js'; diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts index fbb24a9d203f..e86fb2dcf26d 100644 --- a/packages/astro/src/types/public/config.ts +++ b/packages/astro/src/types/public/config.ts @@ -2362,7 +2362,9 @@ export interface AstroUserConfig< * @docs * @name markdown.remarkPlugins * @type {RemarkPlugins} - * @deprecated Pass `remarkPlugins` to `unified({ remarkPlugins })` from `@astrojs/markdown-remark` and set it as `markdown.processor` instead. Will be removed in a future major. + * @deprecated This property is deprecated and will be removed in a future major version. Pass plugins to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead. + * + * Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using plugins](https://docs.astro.build/en/guides/markdown-content/#markdown-processor-plugins) in the Markdown guide. * @description * Pass [remark plugins](https://github.com/remarkjs/remark) to customize how your Markdown is built. You can import and apply the plugin function (recommended), or pass the plugin name as a string. * @@ -2380,7 +2382,9 @@ export interface AstroUserConfig< * @docs * @name markdown.rehypePlugins * @type {RehypePlugins} - * @deprecated Pass `rehypePlugins` to `unified({ rehypePlugins })` from `@astrojs/markdown-remark` and set it as `markdown.processor` instead. Will be removed in a future major. + * @deprecated This property is deprecated and will be removed in a future major version. Pass plugins to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead. + + * Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using plugins](https://docs.astro.build/en/guides/markdown-content/#markdown-processor-plugins) in the Markdown guide. * @description * Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string. * @@ -2400,7 +2404,9 @@ export interface AstroUserConfig< * @type {boolean} * @default `true` * @version 2.0.0 - * @deprecated Pass `gfm` to your processor instead (e.g. `unified({ gfm: false })`). Will be removed in a future major. + * @deprecated This property is deprecated and will be removed in a future major version. Pass `gfm` to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead. + + * Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using GitHub-flavored Markdown](https://docs.astro.build/en/guides/markdown-content/#github-flavored-markdown) in the Markdown guide. * @description * Astro uses [GitHub-flavored Markdown](https://github.com/remarkjs/remark-gfm) by default. To disable this, set the `gfm` flag to `false`: * @@ -2420,7 +2426,9 @@ export interface AstroUserConfig< * @type {boolean | Smartypants} * @default `true` * @version 2.0.0 - * @deprecated Pass `smartypants` to your processor instead (e.g. `unified({ smartypants: false })`). Will be removed in a future major. + * @deprecated This property is deprecated and will be removed in a future major version. Pass it to the configured [`markdown.processor`](https://docs.astro.build/en/reference/configuration-reference/#markdownprocessor) instead. Use `smartypants` for `unified()` or `smartPunctuation` for `satteri()`. + + * Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using smart punctuation](https://docs.astro.build/en/guides/markdown-content/#smart-punctuation) in the Markdown guide. * @description * Whether to use the [SmartyPants formatter](https://daringfireball.net/projects/smartypants/) to transform straight quotes into smart quotes, dashes into en/em dashes, and triple dots into ellipses. * @@ -2434,7 +2442,11 @@ export interface AstroUserConfig< * @docs * @name markdown.remarkRehype * @type {RemarkRehype} - * @deprecated Pass `remarkRehype` to `unified({ remarkRehype })` from `@astrojs/markdown-remark` and set it as `markdown.processor` instead. Will be removed in a future major. + * @deprecated This property is deprecated and will be removed in a future major version. + + * To configure footnotes, pass `remarkRehype` to the `unified()` processor or `gfm.footnotes` to the `satteri()` processor instead. Other `remark-rehype` options are only supported when using `unified()`. + + * Learn more about [setting up a Markdown processor](https://docs.astro.build/en/guides/markdown-content/#setting-up-a-markdown-processor) and [using built-in features](https://docs.astro.build/en/guides/markdown-content/#built-in-features) in the Markdown guide. * @description * Pass options to [remark-rehype](https://github.com/remarkjs/remark-rehype#api). * @@ -2455,8 +2467,9 @@ export interface AstroUserConfig< * @type {MarkdownProcessor} * @version 6.4.0 * @description - * Configures the Markdown processor used to render `.md` files. Defaults to `satteri()` from - * `@astrojs/markdown-satteri`, Astro's native Markdown pipeline. + * Configures the [Markdown processor](https://docs.astro.build/en/guides/markdown-content/#markdown-processors) used to render `.md` files. + * + * Sätteri, Astro’s native Markdown pipeline, is the default processor. To configure it, install `@astrojs/markdown-satteri` and pass options to `satteri()`: * * ```js * // astro.config.mjs @@ -2488,6 +2501,8 @@ export interface AstroUserConfig< * }, * }); * ``` + * + * Learn more about the [official Markdown processors and how to choose one](https://docs.astro.build/en/guides/markdown-content/#choosing-a-markdown-processor) in the Markdown guide. */ processor?: MarkdownProcessor; }; diff --git a/packages/internal-helpers/src/frontmatter.ts b/packages/internal-helpers/src/frontmatter.ts index 9a26b7e3bba0..c6adfd514e5d 100644 --- a/packages/internal-helpers/src/frontmatter.ts +++ b/packages/internal-helpers/src/frontmatter.ts @@ -1,4 +1,4 @@ -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; import * as toml from 'smol-toml'; export function isFrontmatterValid(frontmatter: Record) { diff --git a/packages/language-tools/vscode/scripts/build-grammar.mjs b/packages/language-tools/vscode/scripts/build-grammar.mjs index ab984d7b1790..ac385cbedb0a 100644 --- a/packages/language-tools/vscode/scripts/build-grammar.mjs +++ b/packages/language-tools/vscode/scripts/build-grammar.mjs @@ -1,7 +1,7 @@ // @ts-check import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; import { dim, green } from 'kleur/colors'; const dt = new Intl.DateTimeFormat('en-us', {