Skip to content

Provide TypeScript 7.1 content mapper #533

Open

Description

@remcohaszing

TypeScript introduced the new content mapper API in microsoft/typescript-go#4712. This will be released in TypeScript 7.1. I built mdx-content-mapper as a proof of concept and to provide feedback to the TypeScript team. I took the Volar based MDX virtual content from this repo, and iterated on top of that. I would say it’s already more stable and more feature complete than we ever had in mdx-analyzer.

We can actually use content mappers with tsc, which is a much requested feature and also really convenient for testing. 😄

I intend to incorporate the content mapper inside the mdx-analyzer repo as the @mdx-js/content-mapper package. I intend to do this following a couple of steps, where the first ones involve the removal of TypeScript support based on Volar. I do want to keep Volar and the language server to support editor features provided by vscode-markdown-languageservice.

  • Remove @mdx-js/typescript-plugin from the project. It will no longer be supported. I do not feel the need to deprecate this yet. People may still want to use this in web projects with TypeScript 6 until TypeScript 7 can be used in the browser with a content mapper.
  • Remove the full TypeScript language service support from @mdx-js/language-server.
  • Remove the TypeScript parts from @mdx-js/language-service. Most logic in this project currently involves TypeScript support. Superseded by Replace vscode-languageservice-markdown with our own implementation #537
  • Remove the dependency of @mdx-js/language-server on tsconfig.json. It currently reads remark plugins from this file. We can hardcode sane defaults, or make it configurable using settings if this turns out necessary. This only affects what we pass to vscode-markdown-languageservice.
  • Incorporate @mdx-js/content-mapper into the mdx-analyzer repository.
  • Add @mdx-js/content-mapper support to the VSCode extension.

Considering microsoft/TypeScript#63703, I believe it will be nice if @mdx-js/content-mapper and our VSCode extension are released alongside TypeScript 7.1 RC. During the 7.1 Beta period, users can try mdx-content-mapper instead.

Activity

  1. added
    👋 phase/newPost is being triaged automatically
    🤞 phase/openPost is being triaged manually
    and removed
    👋 phase/newPost is being triaged automatically
    on Aug 28, 2026
  2. added
    🙆 yes/confirmedThis is confirmed and ready to be worked on
    👍 phase/yesPost is accepted and can be worked on
    and removed
    🤞 phase/openPost is being triaged manually
    on Aug 28, 2026
  3. github-actions commented on Aug 28, 2026

    @github-actions
    Contributor

    Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.

    Is this something you can and want to work on?

    Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.

  4. wooorm commented on Aug 30, 2026

    @wooorm
    Member

    the name @mdx-js/content-mapper drops the important typescript-related concept; maybe that's fine, but have you considered alternatives? Is the idea that it works in other tools than TS?

  5. remcohaszing commented on Sep 1, 2026

    @remcohaszing
    MemberAuthor

    I think that’s a fair question. Work is also being done in other ecosystems. Let’s look at their package names. Note that everyone is still working on this. All of these names might still change at any point. Let me know if I forgot any.

    So at this point, there’s a 50/50 split of packages that include typescript / ts in the content mapper package name.

    I expect the term content mapper to become well-known in the frontend ecosystem, similar to a webpack loader or the @types scope.

    I considered the name @mdx-js/typescript-content-mapper, but I think it’s too long. I also considered @mdx-js/ts-content-mapper, but the abbreviated ts- prefix just doesn’t look to great to me. These are just personal opinions, not technical facts.

    What I would personally like, is for TypeScript to suggest a best practice in their docs.

    Is the idea that it works in other tools than TS?

    No. But if there’s user demand, I can imagine the MDX content mapper type checking astro / vue / etc. code blocks using those other content mappers in a future version.

  6. wooorm commented on Sep 1, 2026

    @wooorm
    Member

    I expect the term content mapper to become well-known in the frontend ecosystem, similar to a webpack loader or [...]

    ...with the note that “loader” is very ambiguous, and content mapper pretty unique.

    I considered the name @mdx-js/typescript-content-mapper, but I think it’s too long. I also considered @mdx-js/ts-content-mapper, but the abbreviated ts- prefix just doesn’t look to great to me. These are just personal opinions, not technical facts.

    I think I'd prefer some branding in there, and i agree that typescript- gets long, so I'd go with ts- from those.

    Some more ideas: tsgo-content-mapper, using suffixes instead of prefixes (content-mapper-ts), dropping the content- so @mdx-js/ts-mapper?

  7. remcohaszing commented on Sep 1, 2026

    @remcohaszing
    MemberAuthor

    I think the term tsgo is irrelevant. This is a temporary term that will be used less as more people update to TypeScript 7.

    A suffix makes it sound like a library to me. This reminds me of the good ol’ days when we called libraries jQuery.js, React.js, etc.

    This type of project is called a content mapper. Any form of abbreviation, such as omitting content or mapper, isn’t used elsewhere. I think that would make it less discoverable and makes it stand out from other content mappers.

  8. remcohaszing commented on Sep 16, 2026

    @remcohaszing
    MemberAuthor

    Remove the TypeScript parts from @mdx-js/language-service. Most logic in this project currently involves TypeScript support.

    I feel like we may have an easier time reimplementing the features we want from vscode-markdown-languageservice based on micromark than maintaining Volar mappings. MDX simply isn’t markdown. Notably it has different whitespace rules. And IMO diagnostics specifically are best handled by mdxlint, so the user has both editor and CLI support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions