Skip to content
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

【Bug】localSearchPlugin breaks up other markdown plugin #2313

Closed
4 tasks done
theniceangel opened this issue Apr 29, 2023 · 2 comments · Fixed by #2322
Closed
4 tasks done

【Bug】localSearchPlugin breaks up other markdown plugin #2313

theniceangel opened this issue Apr 29, 2023 · 2 comments · Fixed by #2322
Labels
build Related to the build system

Comments

@theniceangel
Copy link
Contributor

Describe the bug

When i bump to 1.0.0-alpha.74 and configure the search field,start a server will get a error.
The reason is that my markdown plugin which depends on env parameters that contains path info in markdownToVue.ts
image

But when I configure the search field in config.ts, in localSearchPlugin.ts which use md.render(await fs.readFile(file, 'utf-8')), It lacks path info in env object as belows:
image
image

My plugin is a normal markdown plugin which relies env.path.

export const loadContainerPlugin = (md: MarkdownIt) => {
  md.use(markdownItContainer, 'demo', {
    validate(params) {
      return !!params.trim().match(/^demo/)
    },

    render(tokens: Token[], idx, _, env) {
      // It will breaks when working with localSearchPlugin.ts
      console.log(env.path)
    }
  })
}

Reproduction

none

Expected behavior

localSearchPlugin should keep the same logic as markdownToVue when use md.render()

System Info

none

Additional context

No response

Validations

@theniceangel theniceangel added the bug: pending triage Maybe a bug, waiting for confirmation label Apr 29, 2023
@brc-dd brc-dd added build Related to the build system and removed bug: pending triage Maybe a bug, waiting for confirmation labels Apr 29, 2023
@brc-dd
Copy link
Member

brc-dd commented Apr 29, 2023

Feel free to create a PR.

@theniceangel
Copy link
Contributor Author

Feel free to create a PR.

See this PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build Related to the build system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants