markstream-vue2 0.0.19-beta.0 → 0.0.19-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,13 +10,122 @@ pnpm add markstream-vue2
10
10
  # yarn add markstream-vue2
11
11
  ```
12
12
 
13
+ ## Requirements
14
+
15
+ - Vue 2.6.14+ (Vue 2.7 recommended for better TS support)
16
+ - @vue/composition-api (required for Vue 2.6.x)
17
+
18
+ ## Composition API compatibility
19
+
20
+ | Vue version | Composition API availability | What to install | How to import |
21
+ |-------------|------------------------------|-----------------|---------------|
22
+ | **2.6.x** | Not built-in | `@vue/composition-api` | `import { ref, computed, defineComponent } from '@vue/composition-api'` |
23
+ | **2.7.x** | Built-in | None | `import { ref, computed, defineComponent } from 'vue'` |
24
+ | **3.x** | Built-in | None | `import { ref, computed, defineComponent } from 'vue'` |
25
+
26
+ Notes:
27
+ - **Vue 2.6.x** must install and **Vue.use(@vue/composition-api)**.
28
+ - **Vue 2.7.x** should **not** install `@vue/composition-api`.
29
+ - **Vue 3.x** should use **markstream-vue** (not markstream-vue2).
30
+
31
+ ## Quick start by version
32
+
33
+ ### Vue 2.6.x
34
+
35
+ ```bash
36
+ pnpm add markstream-vue2 vue@2.6.14 vue-template-compiler@2.6.14 @vue/composition-api
37
+ ```
38
+
39
+ ```ts
40
+ import VueCompositionAPI from '@vue/composition-api'
41
+ import MarkdownRender, { VueRendererMarkdown } from 'markstream-vue2'
42
+ import Vue from 'vue'
43
+ import 'markstream-vue2/index.css'
44
+
45
+ Vue.use(VueCompositionAPI)
46
+ Vue.use(VueRendererMarkdown)
47
+ ```
48
+
49
+ Repo example:
50
+ - `playground-vue2-cli` (Vue 2.6 + Vue CLI / Webpack 4)
51
+
52
+ Start:
53
+
54
+ ```bash
55
+ pnpm -C playground-vue2-cli dev
56
+ ```
57
+
58
+ From repo root:
59
+
60
+ ```bash
61
+ pnpm play:vue2-cli
62
+ ```
63
+
64
+ ### Vue 2.7.x
65
+
66
+ ```bash
67
+ pnpm add markstream-vue2 vue@2.7.16 vue-template-compiler@2.7.16
68
+ ```
69
+
70
+ ```ts
71
+ import MarkdownRender, { VueRendererMarkdown } from 'markstream-vue2'
72
+ import Vue from 'vue'
73
+ import 'markstream-vue2/index.css'
74
+
75
+ Vue.use(VueRendererMarkdown)
76
+ ```
77
+
78
+ Repo example:
79
+ - `playground-vue2` (Vue 2.7 + Vite)
80
+
81
+ Start:
82
+
83
+ ```bash
84
+ pnpm -C playground-vue2 dev
85
+ ```
86
+
87
+ From repo root:
88
+
89
+ ```bash
90
+ pnpm play:vue2
91
+ ```
92
+
93
+ ### Vue 3.x (use markstream-vue)
94
+
95
+ ```bash
96
+ pnpm add markstream-vue vue@^3
97
+ ```
98
+
99
+ If your workspace also installs Vue 3, ensure `vue-demi` targets Vue 2:
100
+
101
+ ```bash
102
+ pnpm vue-demi-switch 2
103
+ ```
104
+
105
+ If you cannot run `vue-demi-switch`, you can force the Vue 2 build via bundler alias (common in Vue CLI / Webpack 4):
106
+
107
+ ```js
108
+ // vue.config.js / webpack config
109
+ module.exports = {
110
+ configureWebpack: {
111
+ resolve: {
112
+ alias: {
113
+ 'vue-demi$': 'vue-demi/lib/v2/index.cjs',
114
+ },
115
+ },
116
+ },
117
+ }
118
+ ```
119
+
13
120
  ## Usage (Vue 2.6)
14
121
 
15
122
  ```ts
123
+ import VueCompositionAPI from '@vue/composition-api'
16
124
  import MarkdownRender, { VueRendererMarkdown } from 'markstream-vue2'
17
125
  import Vue from 'vue'
18
126
  import 'markstream-vue2/index.css'
19
127
 
128
+ Vue.use(VueCompositionAPI)
20
129
  Vue.use(VueRendererMarkdown)
21
130
 
22
131
  new Vue({
@@ -28,6 +137,20 @@ new Vue({
28
137
  }).$mount('#app')
29
138
  ```
30
139
 
140
+ ## Troubleshooting
141
+
142
+ ### `defineComponent is not a function`
143
+ Cause: `vue-demi` is in Vue 3 mode while the app runs Vue 2.x.
144
+ Fix: run `pnpm vue-demi-switch 2` or alias `vue-demi$` to `vue-demi/lib/v2/index.cjs`.
145
+
146
+ ### `Vue packages version mismatch`
147
+ Cause: `vue` and `vue-template-compiler` versions differ.
148
+ Fix: align both to the same version (e.g. `2.6.14` or `2.7.16`).
149
+
150
+ ### `Cannot read properties of undefined (reading 'props')`
151
+ Cause: Vue 2.6 + Composition API missing `_setupProxy` patch, or plugin not installed.
152
+ Fix: ensure `@vue/composition-api` is installed + `Vue.use(...)`, and update to the latest markstream-vue2 build.
153
+
31
154
  ## Tailwind
32
155
 
33
156
  If your app uses Tailwind and you want to avoid shipping duplicated utility CSS, import the Tailwind-ready output instead: