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

Problems while installing vitepress-plugin-inline-link-preview, cant get ./markdown-it and ./client #159

Closed
Glomzzz opened this issue Apr 14, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation wontfix This will not be worked on

Comments

@Glomzzz
Copy link
Contributor

Glomzzz commented Apr 14, 2024

I was intalling it in this way: https://nolebase-integrations.ayaka.io/pages/en/integrations/vitepress-plugin-inline-link-preview/getting-started.html

but i couldn't get those:

import { 
  InlineLinkPreviewElementTransform 
} from '@nolebase/vitepress-plugin-inline-link-preview/markdown-it'

and

import { 
  NolebaseInlineLinkPreviewPlugin, 
} from '@nolebase/vitepress-plugin-inline-link-preview/client'

well, i'm new to vitepress, i dont know what to do .

is it a bug? or something else.

@nekomeowww
Copy link
Member

nekomeowww commented Apr 14, 2024

Oh, this was unreleased yet (for v2), but will be soon released today.

For now, please refer to #63 and use

// .vitepress/config.ts

import { ElementTransform } from '@nolebase/markdown-it-element-transform'

export default defineConfig({
  markdown: {
    config(md) => {
      md.use(ElementTransform, (() => { 
        let transformNextLinkCloseToken = false 
    
        return { 
          transform(token) { 
            switch (token.type) { 
              case 'link_open': 
                if (token.attrGet('class') !== 'header-anchor') { 
                  token.tag = 'VPNolebaseInlineLinkPreview' 
                  transformNextLinkCloseToken = true 
                } 
                break 
              case 'link_close': 
                if (transformNextLinkCloseToken) { 
                  token.tag = 'VPNolebaseInlineLinkPreview' 
                  transformNextLinkCloseToken = false 
                } 
    
                break 
            } 
          }, 
        } as ElementTransformOptions 
      })())
    }
  }
})

with

// .vitepress/theme/index.ts
import { 
  NolebaseInlineLinkPreviewPlugin, 
} from '@nolebase/vitepress-plugin-inline-link-preview'

directly.

@nekomeowww nekomeowww added documentation Improvements or additions to documentation wontfix This will not be worked on labels Apr 14, 2024
@Glomzzz
Copy link
Contributor Author

Glomzzz commented Apr 14, 2024

thanks for your braaavo plugins

@nekomeowww
Copy link
Member

Released as 2.0.0-rc2, feel free to give it a try 🤭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants