Skip to content

export processIncludes method #4838

@vordimous

Description

@vordimous

Is your feature request related to a problem? Please describe.

I want to render the raw markdown that is processed inside vitepress. I can use createMarkdownRenderer and renderInline, but the @includes content is not imported. I want to include the processed markdown, including any markdown-it and @include evaluation, as a build asset for my VitePress site.

Describe the solution you'd like

I found a way to do this using the internal processIncludes method, if it was exported that would make this code easy to implement:

  buildEnd: async (config: SiteConfig) => {
    const mdR = await createMarkdownRenderer(config.srcDir, config.markdown, config.site.base, config.logger)
    const file = `${config.srcDir}/markdown-examples.md`
    const md_raw = await readFile(file, 'utf-8')
    const md_src = processIncludes(config.srcDir, md_raw, file, [])
    console.log("md", mdR.renderInline(md_src))
  }

I had to manually copy the function from the compiled code, but it works and would be useful.

Describe alternatives you've considered

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions