astro/packages/integrations/markdoc/CHANGELOG.md
Houston (Bot) f0666b92c3
[ci] release (#7594)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-11 22:27:04 +08:00

24 KiB

@astrojs/markdoc

0.4.2

Patch Changes

0.4.1

Patch Changes

0.4.0

Minor Changes

  • #7468 fb7af5511 Thanks @bholmesdev! - Updates the Markdoc config object for rendering Astro components as tags or nodes. Rather than importing components directly, Astro includes a new component() function to specify your component path. This unlocks using Astro components from npm packages and .ts files.

    Migration

    Update all component imports to instead import the new component() function and use it to render your Astro components:

    // markdoc.config.mjs
    import {
      defineMarkdocConfig,
    + component,
    } from '@astrojs/markdoc/config';
    - import Aside from './src/components/Aside.astro';
    
    export default defineMarkdocConfig({
      tags: {
        aside: {
          render: Aside,
    +     render: component('./src/components/Aside.astro'),
        }
      }
    });
    

Patch Changes

0.3.3

Patch Changes

0.3.2

Patch Changes

  • #7311 a11b62ee1 Thanks @bholmesdev! - Fix Markdoc type errors for render and defineMarkdocConfig() when using a TypeScript Markdoc config file.

  • #7309 2a4bb23b2 Thanks @bholmesdev! - Fix missing styles and scripts for components when using document: { render: null } in the Markdoc config.

  • Updated dependencies [8034edd9e]:

    • astro@2.6.1

0.3.1

Patch Changes

0.3.0

Minor Changes

  • #7244 bef3a75db Thanks @bholmesdev! - Remove the auto-generated $entry variable for Markdoc entries. To access frontmatter as a variable, you can pass entry.data as a prop where you render your content:

    ---
    import { getEntry } from 'astro:content';
    
    const entry = await getEntry('docs', 'why-markdoc');
    const { Content } = await entry.render();
    ---
    
    <Content frontmatter={entry.data} />
    

Patch Changes

0.2.3

Patch Changes

0.2.2

Patch Changes

  • #6758 f558a9e20 Thanks @bholmesdev! - Improve style and script handling across content collection files. This addresses style bleed present in @astrojs/markdoc v0.1.0

  • Updated dependencies [f558a9e20, b41963b77]:

    • astro@2.5.3

0.2.1

Patch Changes

0.2.0

Minor Changes

Patch Changes

0.1.3

Patch Changes

0.1.2

Patch Changes

0.1.1

Patch Changes

0.1.0

Minor Changes

  • #6653 7c439868a Thanks @bholmesdev! - Simplify Markdoc configuration with a new markdoc.config.mjs file. This lets you import Astro components directly to render as Markdoc tags and nodes, without the need for the previous components property. This new configuration also unlocks passing variables to your Markdoc from the Content component (see the new docs).

    Migration

    Move any existing Markdoc config from your astro.config to a new markdoc.config.mjs file at the root of your project. This should be applied as a default export, with the optional defineMarkdocConfig() helper for autocomplete in your editor.

    This example configures an aside Markdoc tag. Note that components should be imported and applied to the render attribute directly, instead of passing the name as a string:

    // markdoc.config.mjs
    import { defineMarkdocConfig } from '@astrojs/markdoc/config';
    import Aside from './src/components/Aside.astro';
    
    export default defineMarkdocConfig({
      tags: {
        aside: {
          render: Aside,
        },
      },
    });
    

    You should also remove the components prop from your Content components. Since components are imported into your config directly, this is no longer needed.

    ---
    - import Aside from '../components/Aside.astro';
    import { getEntryBySlug } from 'astro:content';
    
    const entry = await getEntryBySlug('docs', 'why-markdoc');
    const { Content } = await entry.render();
    ---
    
    <Content
    - components={{ Aside }}
    />
    

Patch Changes

0.0.5

Patch Changes

  • #6630 cfcf2e2ff Thanks @bholmesdev! - Support automatic image optimization for Markdoc images when using experimental.assets. You can follow our Assets guide to enable this feature in your project. Then, start using relative or aliased image sources in your Markdoc files for automatic optimization:

    <!--Relative paths-->
    
    ![The Milky Way Galaxy](../assets/galaxy.jpg)
    
    <!--Or configured aliases-->
    
    ![Houston smiling and looking cute](~/assets/houston-smiling.jpg)
    
  • Updated dependencies [b7194103e, cfcf2e2ff, 45da39a86, 7daef9a29]:

    • astro@2.1.7

0.0.4

Patch Changes

  • #6588 f42f47dc6 Thanks @bholmesdev! - Allow access to content collection entry information (including parsed frontmatter and the entry slug) from your Markdoc using the $entry variable:

    ---
    title: Hello Markdoc!
    ---
    
    # {% $entry.data.title %}
    
  • #6607 86273b588 Thanks @bholmesdev! - Fix: Update Markdoc renderer internals to remove unneeded dependencies

  • #6622 b37b86540 Thanks @paulrudy! - Fix README instructions for installing Markdoc manually.

0.0.3

Patch Changes

0.0.2

Patch Changes

0.0.1

Patch Changes

  • #6209 fec583909 Thanks @bholmesdev! - Introduce the (experimental) @astrojs/markdoc integration. This unlocks Markdoc inside your Content Collections, bringing support for Astro and UI components in your content. This also improves Astro core internals to make Content Collections extensible to more file types in the future.

    You can install this integration using the astro add command:

    astro add markdoc
    

    Read the @astrojs/markdoc documentation for usage instructions, and browse the new with-markdoc starter to try for yourself.