-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3: MarkdownRoot body type: "minimal" #3072
Comments
Update: upon lurking around the module source, I found the internal functions Any chance these could be exposed? 🙏 |
As you may already know, minimal format is designed to reduce the dump size and finally the page size. It is yet not supported by
We can expose both types and the |
Thanks for the explanation @farnabaz. For now I solved it like so: //@ts-ignore: Non-documented function
import { decompressTree } from "../../node_modules/@nuxt/content/dist/runtime/internal/abstract-tree.js" Perhaps I have a bug to report pertaining to this (I tried to create a minimal Stackblitz reproduction, but I am getting some When defining a collection like so: export default defineContentConfig({
support: defineCollection({
type: "page",
source: "support/**/*.md",
}),
},
}) And querying it like so: const { data } = await useAsyncData("some-page", () => queryCollection("support").path("/support/some-page").all()) Typescript infers the type as interface SupportCollectionItem extends PageCollectionItemBase {}
But in fact [
{
"id": "support/support/some-page.md",
"title": "Some Page Title",
"body": {
"type": "minimal",
"value": [
[
"p",
{},
"This is some text."
],
...
] Is this a bug and Obviously I can decompress it manually, but the Thanks |
The StackBlitz problem will resolve in
Indeed you right, we should update this type and use minimal type.
There isn't any at the time, and I believe there will not any in future. The minimization reduces tremendous amount of size from dump (~40%-66%). |
Hello,
I have a custom logic from v2 that parsed
MarkdownParsedContent
(nowPageCollectionItemBase
) and constructed a new AST as needed.I have now encountered a different
md
structure forMarkdownRoot
: the typings suggest it should be of typeMDCRoot
withtype: 'root'
, but the actualqueryCollection
outputsbody
oftype: 'minimal'
and a different object shape: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:Do I have any control over how is the format chosen between
minimal
andMDCRoot
withchildren: Array<MDCNode>
as before? Or should theminimal
types be exposed to be available for typings?Thanks
The text was updated successfully, but these errors were encountered: