Remark Structure
Extract information from your documents, useful for implementing document search
Usage
Add it as a remark plugin.
Extracted information could be found in vfile.data.structuredData
, you may
write your own plugin to convert it into a MDX export.
Options
Prop | Type | Default |
---|---|---|
types | Test | ['paragraph', 'blockquote', 'heading', 'tableCell'] |
Output
A list of headings and contents. Paragraphs will be extracted to the contents
array, each item contains a heading
prop indicating the heading of paragraph.
Note
A heading can have multiple paragraphs.
Heading
Prop | |
---|---|
id | unique identifer or slug of heading |
content | Text content |
Content
Prop | |
---|---|
heading | Heading of paragraph (nullable) |
content | Text content |
As a Function
Accepts MDX/markdown content and return structurized data.
Tip
If you have custom remark plugins enabled, such as
remark-math
, you have to pass these plugins to the function. This avoids unreadable content on paragraphs.
Parameters
Parameter | |
---|---|
content | MDX/markdown content |
remarkPlugins | List of remark plugins |
options | Custom options |
Edit on GitHub
Last updated on