vuepress-plugin-demo-code icon indicating copy to clipboard operation
vuepress-plugin-demo-code copied to clipboard

feat: Vuepress 2 support

Open abaanshanid opened this issue 4 years ago • 26 comments

Is your feature request related to a problem? Please describe. I really like this plugin, but I've switched to Vuepress 2. Can you please make this plugin Vuepress 2 compatible?

Thanks

abaanshanid avatar Nov 16 '21 10:11 abaanshanid

OK, I'll try it...

$ npm i -D vuepress-plugin-demo-code@next
# OR
$ pnpm i -D vuepress-plugin-demo-code@next
# OR
$ yarn add -D vuepress-plugin-demo-code@next

BuptStEve avatar Nov 17 '21 08:11 BuptStEve

Does this support Vuepress 2 now?

abaanshanid avatar Mar 05 '22 09:03 abaanshanid

Does this support Vuepress 2 now?

Yeah, try this one~

$ npm i -D vuepress-plugin-demo-code@next
# OR
$ yarn add -D vuepress-plugin-demo-code@next

BuptStEve avatar Mar 09 '22 08:03 BuptStEve

@BuptStEve it doesn't work properly, is it a stable version?

jtommy avatar Mar 29 '22 23:03 jtommy

@BuptStEve it doesn't work properly, is it a stable version?

what's wrong with it? Please provide some pictures or a demo? It's not a stable version, because vuepress@2 is in beta version.

BuptStEve avatar Apr 01 '22 07:04 BuptStEve

@BuptStEve The path separator doesn't look good for windows OS

 Plugin: vite:import-analysis
  File: C:/Users/Walter/Github/oruga/packages/docs-next/.vuepress/.temp/internal/clientAppEnhances.js
  3  |  import clientAppEnhance2 from 'C:/Users/Walter/Github/oruga/packages/docs-next/node_modules/@vuepress/plugin-theme-data/lib/client/clientAppEnhance.js'
  4  |  import clientAppEnhance3 from 'C:/Users/Walter/Github/oruga/packages/docs-next/node_modules/@vuepress/theme-default/lib/client/clientAppEnhance.js'
  5  |  import clientAppEnhance4 from 'C:\Users\Walter\Github\oruga\packages\docs-next\node_modules\vuepress-plugin-demo-code\src\enhanceAppFile.js'     
     |                                 ^
  6  |  import clientAppEnhance5 from 'C:/Users/Walter/Github/oruga/packages/docs-next/.vuepress/clientAppEnhance.ts'

and fiixing it manually

image

jtommy avatar Apr 02 '22 14:04 jtommy

@jtommy Well, I get it. I'll fix this ASAP. Because there are too many breaking changes in Vuepress's beta version, such as this:

image

BuptStEve avatar Apr 03 '22 06:04 BuptStEve

Thanks. What Vuepress 2 version are you supporting at the moment?

jtommy avatar Apr 03 '22 09:04 jtommy

@jtommy 2.0.0-beta.27

I just make it compatible with 2.0.0-beta.37, please wait a moment.

Please try this one~ [email protected]

BuptStEve avatar Apr 03 '22 11:04 BuptStEve

@BuptStEve 2.0.0-beta.38

Uncaught SyntaxError: The requested module '/@fs/C:/Users/Walter/Github/oruga/packages/docs-next/node_modules/codesandbox-import-utils/lib/api/define.js' does not provide an export named 'getParameters'

SyntaxError: The requested module '/@fs/C:/Users/Walter/Github/oruga/packages/docs-next/node_modules/escape-html/index.js' does not provide an export named 'default' (at highlight.js:2:8)

It looks like all import from external libs are broken, probably due to Vite

jtommy avatar Apr 06 '22 22:04 jtommy

@jtommy Maybe add this for now~

// config.js
{
  // ...
  bundlerConfig: {
    viteOptions: {
        optimizeDeps: {
            include: [
                'prismjs',
                'escape-html',
                'codesandbox-import-utils/lib/api/define'
            ],
        }
    }
  }
}

BuptStEve avatar Apr 07 '22 04:04 BuptStEve

@jtommy I just publish this version: [email protected]

BuptStEve avatar Apr 07 '22 06:04 BuptStEve

@BuptStEve thanks. I found the same workaround after my last message. Your last version is ok but you are setting Vue 2, why?

Anyway, I don't think I to be able to use your plugin because in the Vuepress 2.x there is a limit of a script for each .md

jtommy avatar Apr 07 '22 06:04 jtommy

@jtommy I'll use Vue3 as default in next commit. It's fine that you won't use it, every package suits it's own scenario.

BuptStEve avatar Apr 07 '22 07:04 BuptStEve

Or you might add a config to allow us to customize the Vue CDN.

I think the major part of components doc needs to show more than one example for each page (.MD).

jtommy avatar Apr 07 '22 08:04 jtommy

@jtommy [email protected] add vueVersion~ The feature "more than one <script>" is not that easy with current code.

BuptStEve avatar Apr 07 '22 09:04 BuptStEve

Any workaround to meet the need?

jtommy avatar Apr 07 '22 14:04 jtommy

使用了没效果是怎么回事,v2.0.0-beta.38, [email protected]

bobobabab avatar Apr 19 '22 09:04 bobobabab

使用了没效果是怎么回事,v2.0.0-beta.38, [email protected]

27c7477c-7266-44c8-8ca0-7b104bc53de7 image

BuptStEve avatar Apr 20 '22 01:04 BuptStEve

[email protected] 加了template 预览效果显示不出来,需要怎么处理?

bobobabab avatar Apr 21 '22 08:04 bobobabab

@bobobabab 给个复现仓库看看?

BuptStEve avatar Apr 21 '22 14:04 BuptStEve

@BuptStEve
image image image

bobobabab avatar Apr 22 '22 01:04 bobobabab

@bobobabab template display: none; 了?

BuptStEve avatar Apr 22 '22 02:04 BuptStEve

@BuptStEve 是的 要配置么还是直接css改

bobobabab avatar Apr 22 '22 08:04 bobobabab

@BuptStEve vuepress2.0.0 beta4 改变了plugins的引入方式,这边有计划做适配吗

giserMao avatar Apr 26 '22 10:04 giserMao

vuepress2.x support copy button?

bobobabab avatar Nov 25 '22 00:11 bobobabab