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

md file can't use import external resources #922

Closed
3 tasks done
Mamorial opened this issue Jul 6, 2022 · 10 comments
Closed
3 tasks done

md file can't use import external resources #922

Mamorial opened this issue Jul 6, 2022 · 10 comments
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@Mamorial
Copy link

Mamorial commented Jul 6, 2022

Describe the bug

md file can't use import @vicons/antd

My Code
:::demo

<template>
    <wp-icon name="DeleteOutlined"></wp-icon>
</template>

<script lang="ts" setup>
import {RightOutlined} from '@vicons/antd';
</script>

:::

image

Browser Error
image

Reproduction

md file use import

Expected behavior

md file can use import node_modules package

System Info

"vitepress": "1.0.0-alpha.4"
"@vicons/antd": "^0.11.0"
"vite": "^2.9.0"

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@Mamorial Mamorial added the bug: pending triage Maybe a bug, waiting for confirmation label Jul 6, 2022
@Mamorial
Copy link
Author

Mamorial commented Jul 6, 2022

"vitepress": "0.22.4"

@brc-dd
Copy link
Member

brc-dd commented Jul 6, 2022

What is :::demo? In the screenshot you've shown, its inside a code block. Not sure what you meant by importing it. Anything you put inside a code block will render as is. But I am guessing that your demo container somehow extracts that and tries to render it. The issue is probably with that component.

@Mamorial
Copy link
Author

Mamorial commented Jul 6, 2022

:::demo Has it been abandoned? I want to run VUE code in MD file

@brc-dd
Copy link
Member

brc-dd commented Jul 6, 2022

I don't think there was any such thing in VitePress (I guess you're confused between VitePress and VuePress, in VuePress there are some plugins using which you can show demos). In VitePress, you can use Vue directly in markdown like this:

# Hey there

<right-outlined />

<script setup lang="ts">
import { RightOutlined } from '@vicons/antd'
</script>

@Mamorial
Copy link
Author

Mamorial commented Jul 6, 2022

yes i know, but I want to render directly in MD files, like the following
image

@brc-dd
Copy link
Member

brc-dd commented Jul 6, 2022

Yeah, that's what I'm saying, you don't need to put that demo block. Put that content directly inside your md file:

image

@Mamorial
Copy link
Author

Mamorial commented Jul 6, 2022

I used this theme
image

@brc-dd
Copy link
Member

brc-dd commented Jul 6, 2022

That theme is not official. You can create issues on its repo (https://github.com/xinlei3166/vitepress-theme-demoblock) if something isn't working. But this clearly isn't an issue with VitePress.

@Mamorial
Copy link
Author

Mamorial commented Jul 6, 2022

OK I got it thank you very much

@brc-dd
Copy link
Member

brc-dd commented Jul 6, 2022

I had wrote a simple component that did that demo thing for an issue here. But I'm unable to find that. As for the element plus, you can do this: #603 (comment). If you can write a demo plugin for yourself then you don't need that theme at all IG (also it isn't updated for v1-alpha I believe). I am closing this for now. If you need some help then create a discussion or ask on Vue's discord (https://chat.vuejs.org/).

@brc-dd brc-dd closed this as completed Jul 6, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants