Skip to content

MDX extension for VS Code deletes frontmatter when Astro imports are added #517

@sillvva

Description

@sillvva

Initial checklist

Affected package

unifiedjs.vscode-mdx@1.8.14

Steps to reproduce

I disabled every other extension in VS code except MDX and the issue still occurs. Only by disabling the MDX extension does the issue stop happening.

I can reproduce the issue with this code in my Astro blog. Adding the Astro component import and saving (with format on save) causes the frontmatter to be completely deleted. It also deletes the import.

---
title: Svelte Breadcrumbs Made Easy
description: A collection of methods to create a single breadcrumbs component which uses route data to generate breadcrumbs.
date: 2023-07-14T03:53:16.000Z
updated: 2025-08-27T14:40:33.184Z
image: $/assets/images/breadcrumbs.webp
tags:
  - TypeScript
  - SvelteKit
  - UI
---

import TabbedCode from "$/components/markdown/code/tabbed.astro";

Actual behavior

It is deleting the frontmatter and imports when I save the file.

Expected behavior

It should not delete the frontmatter and imports when I save the file.

Runtime

Cursor

Package manager

I don't think it's relevant to a VS Code extension

Operating system

MacOS

Build and bundle tools

Astro

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤞 phase/openPost is being triaged manually

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions