Skip to content

v3: MarkdownRoot body type: "minimal" #3072

@chrisjansky

Description

@chrisjansky

Hello,

I have a custom logic from v2 that parsed MarkdownParsedContent (now PageCollectionItemBase) and constructed a new AST as needed.

I have now encountered a different md structure for MarkdownRoot: the typings suggest it should be of type MDCRoot with type: 'root', but the actual queryCollection outputs body of type: 'minimal' and a different object shape:

"body": {
      "type": "minimal",
      "value": [
        [
          "h1",
          {
            "id": "licensing-basics"
          },
          "Licensing Basics"
        ],
...

Lurking around in source I see the minimal types in module.d.ts but I see no mention in the docs and they are not exported so clearly purely internal:

type MinimalText = string;
type MinimalElement = [string, Record<string, unknown>, ...MinimalNode[]];
type MinimalNode = MinimalElement | MinimalText;
type MinimalTree = {
    type: 'minimal';
    value: MinimalNode[];
};

Do I have any control over how is the format chosen between minimal and MDCRoot with children: Array<MDCNode> as before? Or should the minimal types be exposed to be available for typings?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions