github withastro/astro @astrojs/markdoc@0.12.0-beta.0

latest release: astro@5.0.0-beta.5
pre-releaseone day ago

@astrojs/markdoc

0.11.5-beta.1

Patch Changes

  • #12075 a19530e Thanks @bluwy! - Parses frontmatter ourselves

  • Updated dependencies [a19530e]:

    • @astrojs/markdown-remark@6.0.0-beta.2

0.11.5-beta.0

Patch Changes

  • Updated dependencies [5608338]:
    • @astrojs/markdown-remark@6.0.0-beta.1

1.0.0-alpha.1

Patch Changes

1.0.0-alpha.0

Patch Changes

0.11.5

Patch Changes

  • Updated dependencies [710a1a1]:
    • @astrojs/markdown-remark@5.3.0

0.11.4

Patch Changes

  • #11846 ed7bbd9 Thanks @HiDeoo! - Fixes an issue preventing to use Astro components as Markdoc tags and nodes when configured using the extends property.

0.11.3

Patch Changes

  • Updated dependencies [49b5145]:
    • @astrojs/markdown-remark@5.2.0

0.11.2

Patch Changes

0.11.1

Patch Changes

  • Updated dependencies [b6afe6a, 41064ce]:
    • @astrojs/markdown-remark@5.1.1
    • @astrojs/internal-helpers@0.4.1

0.11.0

Minor Changes

Patch Changes

  • #10833 8d5f3e8 Thanks @renovate! - Updates esbuild dependency to v0.20. This should not affect projects in most cases.

0.10.0

Minor Changes

Patch Changes

0.9.5

Patch Changes

  • #10649 90cfade88c2b9a34d8a5fe711ce329732d690409 Thanks @bholmesdev! - Add automatic resolution for Markdoc partials. This allows you to render other Markdoc files inside of a given entry. Reference files using the partial tag with a file attribute for the relative file path:

    <!--src/content/blog/post.mdoc-->
    
    {% partial file="my-partials/_diagram.mdoc" /%}
    
    <!--src/content/blog/my-partials/_diagram.mdoc-->
    
    ## Diagram
    
    This partial will render inside of `post.mdoc.`
    
    ![Diagram](./diagram.png)

0.9.4

Patch Changes

0.9.3

Patch Changes

0.9.2

Patch Changes

0.9.1

Patch Changes

0.9.0

Minor Changes

  • #9958 14ce8a6ebfc9daf951d2dca54737d857c229667c Thanks @Princesseuh! - Adds support for using a custom tag (component) for optimized images

    Starting from this version, when a tag called image is used, its src attribute will automatically be resolved if it's a local image. Astro will pass the result ImageMetadata object to the underlying component as the src prop. For non-local images (i.e. images using URLs or absolute paths), Astro will continue to pass the src as a string.

    // markdoc.config.mjs
    import { component, defineMarkdocConfig, nodes } from '@astrojs/markdoc/config';
    
    export default defineMarkdocConfig({
      tags: {
        image: {
          attributes: nodes.image.attributes,
          render: component('./src/components/MarkdocImage.astro'),
        },
      },
    });
    ---
    // src/components/MarkdocImage.astro
    import { Image } from 'astro:assets';
    
    interface Props {
      src: ImageMetadata | string;
      alt: string;
      width: number;
      height: number;
    }
    
    const { src, alt, width, height } = Astro.props;
    ---
    
    <Image {src} {alt} {width} {height} />
    {% image src="./astro-logo.png" alt="Astro Logo" width="100" height="100" %}

0.8.3

Patch Changes

0.8.2

Patch Changes

0.8.1

Patch Changes

0.8.0

Minor Changes

1.0.0-beta.1

Minor Changes

1.0.0-beta.0

Patch Changes

0.7.2

Patch Changes

  • #9083 4537ecf0d Thanks @bluwy! - Uses new createShikiHighlighter API from @astrojs/markdown-remark to avoid code duplication

0.7.1

Patch Changes

0.7.0

Minor Changes

  • #8802 73b8d60f8 Thanks @AndyClifford! - Added ignoreIndentation as a markdoc integration option to enable better readability of source code.

Patch Changes

  • Updated dependencies [26b77b8fe]:
    • astro@3.3.4

0.6.0

Minor Changes

  • #8502 c4270e476 Thanks @bluwy! - Updates the internal shiki syntax highlighter to shikiji, an ESM-focused alternative that simplifies bundling and maintenance.

    There are no new options and no changes to how you author code blocks and syntax highlighting.

    Potentially breaking change: While this refactor should be transparent for most projects, the transition to shikiji now produces a smaller HTML markup by attaching a fallback color style to the pre or code element, instead of to the line span directly. For example:

    Before:

    <code class="astro-code" style="background-color: #24292e">
      <pre>
        <span class="line" style="color: #e1e4e8">my code</span>
      </pre>
    </code>

    After:

    <code class="astro-code" style="background-color: #24292e; color: #e1e4e8">
      <pre>
        <span class="line">my code<span>
      </pre>
    </code>

    This does not affect the colors as the span will inherit the color from the parent, but if you're relying on a specific HTML markup, please check your site carefully after upgrading to verify the styles.

Patch Changes

0.5.2

Patch Changes

0.5.1

Patch Changes

0.5.0

Minor Changes

  • #8188 d0679a666 Thanks @ematipico! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.

  • #8179 6011d52d3 Thanks @matthewp! - Astro 3.0 Release Candidate

  • #8169 e79e3779d Thanks @bluwy! - Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:

    • material-darker -> material-theme-darker
    • material-default -> material-theme
    • material-lighter -> material-theme-lighter
    • material-ocean -> material-theme-ocean
    • material-palenight -> material-theme-palenight

Patch Changes

0.5.0-rc.1

Minor Changes

  • #8179 6011d52d3 Thanks @matthewp! - Astro 3.0 Release Candidate

  • #8169 e79e3779d Thanks @bluwy! - Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:

    • material-darker -> material-theme-darker
    • material-default -> material-theme
    • material-lighter -> material-theme-lighter
    • material-ocean -> material-theme-ocean
    • material-palenight -> material-theme-palenight

Patch Changes

1.0.0-beta.1

Patch Changes

  • Updated dependencies [2aa6d8ace]:
    • @astrojs/internal-helpers@0.2.0-beta.1
    • astro@3.0.0-beta.2

1.0.0-beta.0

Minor Changes

  • 1eae2e3f7 Thanks @Princesseuh! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.

Patch Changes

0.4.4

Patch Changes

  • #7597 7461e82c8 Thanks @alex-sherwin! - Adds an "allowHTML" Markdoc integration option.

    When enabled, all HTML in Markdoc files will be processed, including HTML elements within Markdoc tags and nodes.

    Enable this feature in the markdoc integration configuration:

    // astro.config.mjs
    export default defineConfig({
      integrations: [markdoc({ allowHTML: true })],
    });
  • Updated dependencies [0f677c009, 188eeddd4]:

    • astro@2.9.3

0.4.3

Patch Changes

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.

Don't miss a new astro release

NewReleases is sending notifications on new releases.