@umbra.ui/core 0.1.0
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/dist/components/controls/Dropdown/types.d.ts +5 -0
- package/dist/components/controls/Dropdown/types.d.ts.map +1 -0
- package/dist/components/controls/Dropdown/types.js +1 -0
- package/dist/components/controls/SegmentedControl/types.d.ts +6 -0
- package/dist/components/controls/SegmentedControl/types.d.ts.map +1 -0
- package/dist/components/controls/SegmentedControl/types.js +1 -0
- package/dist/components/dialogs/Alert/types.d.ts +7 -0
- package/dist/components/dialogs/Alert/types.d.ts.map +1 -0
- package/dist/components/dialogs/Alert/types.js +1 -0
- package/dist/components/dialogs/Toast/types.d.ts +34 -0
- package/dist/components/dialogs/Toast/types.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/types.js +10 -0
- package/dist/components/dialogs/Toast/useToast.d.ts +36 -0
- package/dist/components/dialogs/Toast/useToast.d.ts.map +1 -0
- package/dist/components/dialogs/Toast/useToast.js +90 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts +3 -0
- package/dist/components/indicators/Tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/tooltip.js +33 -0
- package/dist/components/indicators/Tooltip/types.d.ts +14 -0
- package/dist/components/indicators/Tooltip/types.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/types.js +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts +18 -0
- package/dist/components/indicators/Tooltip/useTooltip.d.ts.map +1 -0
- package/dist/components/indicators/Tooltip/useTooltip.js +57 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts +14 -0
- package/dist/components/inputs/Tags/tag-bar-styles.d.ts.map +1 -0
- package/dist/components/inputs/Tags/tag-bar-styles.js +313 -0
- package/dist/components/inputs/Tags/types.d.ts +93 -0
- package/dist/components/inputs/Tags/types.d.ts.map +1 -0
- package/dist/components/inputs/Tags/types.js +216 -0
- package/dist/components/inputs/search/types.d.ts +9 -0
- package/dist/components/inputs/search/types.d.ts.map +1 -0
- package/dist/components/inputs/search/types.js +1 -0
- package/dist/components/navigation/adaptive/types.d.ts +16 -0
- package/dist/components/navigation/adaptive/types.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/types.js +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts +27 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.js +40 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts +6 -0
- package/dist/components/navigation/adaptive/useBreakpoints.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useBreakpoints.js +37 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts +93 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.js +145 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts +31 -0
- package/dist/components/navigation/adaptive/useViewAnimation.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewAnimation.js +591 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts +52 -0
- package/dist/components/navigation/adaptive/useViewResize.d.ts.map +1 -0
- package/dist/components/navigation/adaptive/useViewResize.js +146 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts +25 -0
- package/dist/components/navigation/navstack/useNavigationStack.d.ts.map +1 -0
- package/dist/components/navigation/navstack/useNavigationStack.js +133 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts +20 -0
- package/dist/components/navigation/slideover/useSlideoverController.d.ts.map +1 -0
- package/dist/components/navigation/slideover/useSlideoverController.js +267 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts +20 -0
- package/dist/components/navigation/splitview/useSplitViewController.d.ts.map +1 -0
- package/dist/components/navigation/splitview/useSplitViewController.js +325 -0
- package/dist/components/navigation/tabcontroller/types.d.ts +21 -0
- package/dist/components/navigation/tabcontroller/types.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/types.js +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts +5 -0
- package/dist/components/navigation/tabcontroller/useTabController.d.ts.map +1 -0
- package/dist/components/navigation/tabcontroller/useTabController.js +10 -0
- package/dist/components/navigation/types.d.ts +8 -0
- package/dist/components/navigation/types.d.ts.map +1 -0
- package/dist/components/navigation/types.js +1 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts +11 -0
- package/dist/components/pickers/CollectionPicker/types.d.ts.map +1 -0
- package/dist/components/pickers/CollectionPicker/types.js +1 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts +13 -0
- package/dist/components/pickers/ColorPicker/colors.d.ts.map +1 -0
- package/dist/components/pickers/ColorPicker/colors.js +266 -0
- package/dist/components/pickers/FilePicker/types.d.ts +10 -0
- package/dist/components/pickers/FilePicker/types.d.ts.map +1 -0
- package/dist/components/pickers/FilePicker/types.js +1 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +279 -0
- package/dist/themes/blank.d.ts +7 -0
- package/dist/themes/blank.d.ts.map +1 -0
- package/dist/themes/blank.js +543 -0
- package/dist/themes/crimson-dark.d.ts +4 -0
- package/dist/themes/crimson-dark.d.ts.map +1 -0
- package/dist/themes/crimson-dark.js +552 -0
- package/dist/themes/cyan-light.d.ts +4 -0
- package/dist/themes/cyan-light.d.ts.map +1 -0
- package/dist/themes/cyan-light.js +552 -0
- package/dist/themes/dark.d.ts +4 -0
- package/dist/themes/dark.d.ts.map +1 -0
- package/dist/themes/dark.js +551 -0
- package/dist/themes/gold-dark.d.ts +4 -0
- package/dist/themes/gold-dark.d.ts.map +1 -0
- package/dist/themes/gold-dark.js +552 -0
- package/dist/themes/grass-dark.d.ts +4 -0
- package/dist/themes/grass-dark.d.ts.map +1 -0
- package/dist/themes/grass-dark.js +552 -0
- package/dist/themes/indigo.d.ts +4 -0
- package/dist/themes/indigo.d.ts.map +1 -0
- package/dist/themes/indigo.js +552 -0
- package/dist/themes/light.d.ts +4 -0
- package/dist/themes/light.d.ts.map +1 -0
- package/dist/themes/light.js +551 -0
- package/dist/themes/orange-dark.d.ts +4 -0
- package/dist/themes/orange-dark.d.ts.map +1 -0
- package/dist/themes/orange-dark.js +551 -0
- package/dist/themes/orange-light.d.ts +4 -0
- package/dist/themes/orange-light.d.ts.map +1 -0
- package/dist/themes/orange-light.js +551 -0
- package/package.json +62 -0
- package/src/components/controls/Button/Button.vue +417 -0
- package/src/components/controls/Button/README.md +348 -0
- package/src/components/controls/Button/theme.css +200 -0
- package/src/components/controls/Checkbox/Checkbox.vue +164 -0
- package/src/components/controls/Checkbox/README.md +441 -0
- package/src/components/controls/Checkbox/theme.css +36 -0
- package/src/components/controls/Dropdown/Dropdown.vue +476 -0
- package/src/components/controls/Dropdown/README.md +370 -0
- package/src/components/controls/Dropdown/theme.css +50 -0
- package/src/components/controls/Dropdown/types.ts +6 -0
- package/src/components/controls/IconButton/IconButton.vue +267 -0
- package/src/components/controls/IconButton/README.md +502 -0
- package/src/components/controls/IconButton/theme.css +89 -0
- package/src/components/controls/Radio/README.md +591 -0
- package/src/components/controls/Radio/Radio.vue +89 -0
- package/src/components/controls/Radio/theme.css +14 -0
- package/src/components/controls/RangeSlider/README.md +608 -0
- package/src/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/src/components/controls/RangeSlider/theme.css +80 -0
- package/src/components/controls/SegmentedControl/README.md +587 -0
- package/src/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/src/components/controls/SegmentedControl/theme.css +60 -0
- package/src/components/controls/SegmentedControl/types.ts +5 -0
- package/src/components/controls/Slider/README.md +627 -0
- package/src/components/controls/Slider/Slider.vue +260 -0
- package/src/components/controls/Slider/theme.css +74 -0
- package/src/components/controls/Stepper/README.md +601 -0
- package/src/components/controls/Stepper/Stepper.vue +103 -0
- package/src/components/controls/Stepper/theme.css +53 -0
- package/src/components/controls/Switch/README.md +667 -0
- package/src/components/controls/Switch/Switch.vue +127 -0
- package/src/components/controls/Switch/theme.css +42 -0
- package/src/components/dialogs/Alert/Alert.vue +218 -0
- package/src/components/dialogs/Alert/README.md +450 -0
- package/src/components/dialogs/Alert/theme.css +44 -0
- package/src/components/dialogs/Alert/types.ts +11 -0
- package/src/components/dialogs/Toast/README.md +522 -0
- package/src/components/dialogs/Toast/Toast.vue +296 -0
- package/src/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/src/components/dialogs/Toast/theme.css +44 -0
- package/src/components/dialogs/Toast/types.ts +46 -0
- package/src/components/dialogs/Toast/useToast.ts +127 -0
- package/src/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/src/components/indicators/ProgressBar/README.md +744 -0
- package/src/components/indicators/ProgressBar/theme.css +36 -0
- package/src/components/indicators/Tooltip/README.md +723 -0
- package/src/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/src/components/indicators/Tooltip/theme.css +18 -0
- package/src/components/indicators/Tooltip/tooltip.ts +48 -0
- package/src/components/indicators/Tooltip/types.ts +15 -0
- package/src/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/src/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/src/components/inputs/AutogrowTextView/README.md +643 -0
- package/src/components/inputs/AutogrowTextView/theme.css +28 -0
- package/src/components/inputs/InputCard/InputCard.vue +600 -0
- package/src/components/inputs/InputCard/README.md +636 -0
- package/src/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/src/components/inputs/InputEmail/README.md +764 -0
- package/src/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/src/components/inputs/InputNumber/README.md +749 -0
- package/src/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/src/components/inputs/InputPhone/README.md +636 -0
- package/src/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/src/components/inputs/InputSecure/README.md +771 -0
- package/src/components/inputs/InputText/InputText.vue +225 -0
- package/src/components/inputs/InputText/README.md +844 -0
- package/src/components/inputs/OTP/OTP.vue +349 -0
- package/src/components/inputs/OTP/README.md +736 -0
- package/src/components/inputs/OTP/theme.css +50 -0
- package/src/components/inputs/StringCapture/README.md +718 -0
- package/src/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/src/components/inputs/StringCapture/theme.css +86 -0
- package/src/components/inputs/Tags/README.md +897 -0
- package/src/components/inputs/Tags/TagBar.vue +793 -0
- package/src/components/inputs/Tags/TagCreation.vue +219 -0
- package/src/components/inputs/Tags/TagPicker.vue +380 -0
- package/src/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/src/components/inputs/Tags/theme.css +121 -0
- package/src/components/inputs/Tags/types.ts +346 -0
- package/src/components/inputs/search/README.md +759 -0
- package/src/components/inputs/search/SearchBar.vue +394 -0
- package/src/components/inputs/search/SearchResults.vue +310 -0
- package/src/components/inputs/search/theme.css +187 -0
- package/src/components/inputs/search/types.ts +8 -0
- package/src/components/inputs/theme.css +102 -0
- package/src/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/src/components/menus/ActionMenu/README.md +825 -0
- package/src/components/menus/ActionMenu/theme.css +93 -0
- package/src/components/models/Popover/Popover.vue +551 -0
- package/src/components/models/Popover/README.md +885 -0
- package/src/components/models/Popover/theme.css +52 -0
- package/src/components/models/Sheet/README.md +1159 -0
- package/src/components/models/Sheet/Sheet.vue +465 -0
- package/src/components/models/Sheet/theme.css +72 -0
- package/src/components/models/Sidebar/README.md +1228 -0
- package/src/components/models/Sidebar/Sidebar.vue +480 -0
- package/src/components/models/Sidebar/theme.css +90 -0
- package/src/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/src/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/src/components/navigation/adaptive/README.md +768 -0
- package/src/components/navigation/adaptive/types.ts +19 -0
- package/src/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/src/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/src/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/src/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/src/components/navigation/adaptive/useViewResize.ts +211 -0
- package/src/components/navigation/navstack/NavigationStack.vue +180 -0
- package/src/components/navigation/navstack/README.md +994 -0
- package/src/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/src/components/navigation/slideover/README.md +1275 -0
- package/src/components/navigation/slideover/SlideoverController.vue +287 -0
- package/src/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/src/components/navigation/splitview/README.md +1115 -0
- package/src/components/navigation/splitview/SplitViewController.vue +176 -0
- package/src/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/src/components/navigation/tabcontroller/README.md +919 -0
- package/src/components/navigation/tabcontroller/TabController.vue +307 -0
- package/src/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/src/components/navigation/tabcontroller/types.ts +24 -0
- package/src/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/src/components/navigation/theme.css +91 -0
- package/src/components/navigation/types.ts +7 -0
- package/src/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/src/components/pickers/CollectionPicker/README.md +1115 -0
- package/src/components/pickers/CollectionPicker/theme.css +14 -0
- package/src/components/pickers/CollectionPicker/types.ts +11 -0
- package/src/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/src/components/pickers/ColorPicker/README.md +1439 -0
- package/src/components/pickers/ColorPicker/colors.ts +299 -0
- package/src/components/pickers/ColorPicker/theme.css +32 -0
- package/src/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/src/components/pickers/DatePicker/README.md +1195 -0
- package/src/components/pickers/DatePicker/theme.css +22 -0
- package/src/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/src/components/pickers/FilePicker/README.md +1542 -0
- package/src/components/pickers/FilePicker/theme.css +48 -0
- package/src/components/pickers/FilePicker/types.ts +10 -0
- package/src/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/src/components/pickers/IconPicker/README.md +1161 -0
- package/src/components/pickers/IconPicker/theme.css +28 -0
- package/src/components/pickers/theme.css +82 -0
- package/src/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/src/components/views/MarkdownViewer/README.md +833 -0
- package/src/components/views/MarkdownViewer/theme.css +130 -0
- package/src/index.ts +263 -0
- package/src/theme.ts +378 -0
- package/src/themes/crimson-dark.ts +556 -0
- package/src/themes/cyan-light.ts +556 -0
- package/src/themes/dark.ts +557 -0
- package/src/themes/gold-dark.ts +556 -0
- package/src/themes/grass-dark.ts +556 -0
- package/src/themes/indigo.ts +556 -0
- package/src/themes/light.ts +557 -0
- package/src/themes/orange-dark.ts +557 -0
- package/src/themes/orange-light.ts +557 -0
- package/src/vue.d.ts +45 -0
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
# MarkdownViewer
|
|
2
|
+
|
|
3
|
+
A comprehensive markdown viewer component built with Vue 3 Composition API and TypeScript. The MarkdownViewer provides rich markdown rendering with syntax highlighting, copy-to-clipboard functionality for code blocks, and extensive theming support for both light and dark modes.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Dependencies:**
|
|
12
|
+
|
|
13
|
+
- Vue 3.x
|
|
14
|
+
- marked (for markdown parsing)
|
|
15
|
+
- prismjs (for syntax highlighting)
|
|
16
|
+
- @umbra-ui/icons (for copy button icons)
|
|
17
|
+
|
|
18
|
+
## Basic Usage
|
|
19
|
+
|
|
20
|
+
```vue
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { ref } from "vue";
|
|
23
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
24
|
+
|
|
25
|
+
const markdownContent = ref(`
|
|
26
|
+
# Hello World
|
|
27
|
+
|
|
28
|
+
This is a **markdown** document with \`inline code\` and a code block:
|
|
29
|
+
|
|
30
|
+
\`\`\`typescript
|
|
31
|
+
const greeting = "Hello, World!";
|
|
32
|
+
console.log(greeting);
|
|
33
|
+
\`\`\`
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- Syntax highlighting
|
|
38
|
+
- Copy to clipboard
|
|
39
|
+
- Responsive tables
|
|
40
|
+
- Beautiful typography
|
|
41
|
+
`);
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div class="app">
|
|
46
|
+
<MarkdownViewer :content="markdownContent" />
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style module>
|
|
51
|
+
.app {
|
|
52
|
+
max-width: 800px;
|
|
53
|
+
margin: 0 auto;
|
|
54
|
+
padding: 2rem;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Props
|
|
60
|
+
|
|
61
|
+
| Prop Name | Type | Required | Default | Description |
|
|
62
|
+
| --------- | -------- | -------- | ------- | ------------------------------ |
|
|
63
|
+
| `content` | `string` | Yes | `""` | The markdown content to render |
|
|
64
|
+
|
|
65
|
+
## Events
|
|
66
|
+
|
|
67
|
+
This component does not emit any events.
|
|
68
|
+
|
|
69
|
+
## Slots
|
|
70
|
+
|
|
71
|
+
This component does not provide any slots.
|
|
72
|
+
|
|
73
|
+
## Exposed Methods/Refs
|
|
74
|
+
|
|
75
|
+
This component does not expose any methods or refs.
|
|
76
|
+
|
|
77
|
+
## CSS Customization
|
|
78
|
+
|
|
79
|
+
The MarkdownViewer component supports extensive theming through CSS custom properties:
|
|
80
|
+
|
|
81
|
+
### Container and Typography
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
:root {
|
|
85
|
+
/* Container colors */
|
|
86
|
+
--markdownviewer-container-color: var(--text-2);
|
|
87
|
+
--markdownviewer-container-font-family: -apple-system, BlinkMacSystemFont,
|
|
88
|
+
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans",
|
|
89
|
+
"Droid Sans", "Helvetica Neue", sans-serif;
|
|
90
|
+
|
|
91
|
+
/* Header colors */
|
|
92
|
+
--markdownviewer-header-color: var(--text-primary);
|
|
93
|
+
--markdownviewer-header-border: rgba(0, 0, 0, 0.1);
|
|
94
|
+
|
|
95
|
+
/* Paragraph colors */
|
|
96
|
+
--markdownviewer-paragraph-color: var(--text-secondary);
|
|
97
|
+
|
|
98
|
+
/* Link colors */
|
|
99
|
+
--markdownviewer-link-color: var(--link);
|
|
100
|
+
--markdownviewer-link-hover-color: var(--accent);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Code Blocks and Syntax Highlighting
|
|
105
|
+
|
|
106
|
+
```css
|
|
107
|
+
:root {
|
|
108
|
+
/* Inline code */
|
|
109
|
+
--markdownviewer-inline-code-bg: #f3f4f6;
|
|
110
|
+
--markdownviewer-inline-code-color: #1f2937;
|
|
111
|
+
|
|
112
|
+
/* Code blocks */
|
|
113
|
+
--markdownviewer-code-block-bg: #ffffff;
|
|
114
|
+
--markdownviewer-code-block-border: #e1e4e8;
|
|
115
|
+
--markdownviewer-code-block-color: #24292e;
|
|
116
|
+
|
|
117
|
+
/* Copy button */
|
|
118
|
+
--markdownviewer-copy-button-color: #24292e;
|
|
119
|
+
--markdownviewer-copy-button-bg: transparent;
|
|
120
|
+
--markdownviewer-copy-button-hover-bg: #f6f8fa;
|
|
121
|
+
--markdownviewer-copy-button-copied-color: #22863a;
|
|
122
|
+
--markdownviewer-copy-button-copied-border: #34d058;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Tables and Other Elements
|
|
127
|
+
|
|
128
|
+
```css
|
|
129
|
+
:root {
|
|
130
|
+
/* Tables */
|
|
131
|
+
--markdownviewer-table-border: rgba(0, 0, 0, 0.1);
|
|
132
|
+
--markdownviewer-table-th-bg: #f9fafb;
|
|
133
|
+
--markdownviewer-table-th-color: #1f2937;
|
|
134
|
+
--markdownviewer-table-tr-even-bg: #f3f4f6;
|
|
135
|
+
--markdownviewer-table-tr-hover-bg: #e5e7eb;
|
|
136
|
+
|
|
137
|
+
/* Horizontal rules */
|
|
138
|
+
--markdownviewer-hr-bg: rgba(0, 0, 0, 0.1);
|
|
139
|
+
|
|
140
|
+
/* Blockquotes */
|
|
141
|
+
--markdownviewer-blockquote-color: #6b7280;
|
|
142
|
+
--markdownviewer-blockquote-border: rgba(0, 0, 0, 0.1);
|
|
143
|
+
|
|
144
|
+
/* Strong text */
|
|
145
|
+
--markdownviewer-strong-color: #1f2937;
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Syntax Highlighting Tokens
|
|
150
|
+
|
|
151
|
+
```css
|
|
152
|
+
:root {
|
|
153
|
+
/* Syntax highlighting colors */
|
|
154
|
+
--markdownviewer-token-comment: #6a737d;
|
|
155
|
+
--markdownviewer-token-punctuation: #24292e;
|
|
156
|
+
--markdownviewer-token-tag: #0550ae;
|
|
157
|
+
--markdownviewer-token-property: #116329;
|
|
158
|
+
--markdownviewer-token-boolean: #cf222e;
|
|
159
|
+
--markdownviewer-token-string: #0a3069;
|
|
160
|
+
--markdownviewer-token-operator: #24292e;
|
|
161
|
+
--markdownviewer-token-keyword: #cf222e;
|
|
162
|
+
--markdownviewer-token-function: #953800;
|
|
163
|
+
--markdownviewer-token-regex: #953800;
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Examples
|
|
168
|
+
|
|
169
|
+
### Documentation Viewer
|
|
170
|
+
|
|
171
|
+
```vue
|
|
172
|
+
<script setup lang="ts">
|
|
173
|
+
import { ref, onMounted } from "vue";
|
|
174
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
175
|
+
|
|
176
|
+
const documentation = ref("");
|
|
177
|
+
|
|
178
|
+
const loadDocumentation = async () => {
|
|
179
|
+
try {
|
|
180
|
+
const response = await fetch("/api/documentation");
|
|
181
|
+
documentation.value = await response.text();
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.error("Failed to load documentation:", error);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
onMounted(() => {
|
|
188
|
+
loadDocumentation();
|
|
189
|
+
});
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<template>
|
|
193
|
+
<div class="documentation-viewer">
|
|
194
|
+
<div class="sidebar">
|
|
195
|
+
<h3>Table of Contents</h3>
|
|
196
|
+
<!-- Navigation items -->
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="content">
|
|
200
|
+
<MarkdownViewer :content="documentation" />
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
</template>
|
|
204
|
+
|
|
205
|
+
<style module>
|
|
206
|
+
.documentation-viewer {
|
|
207
|
+
display: flex;
|
|
208
|
+
height: 100vh;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.sidebar {
|
|
212
|
+
width: 300px;
|
|
213
|
+
background: var(--background-2);
|
|
214
|
+
padding: 1rem;
|
|
215
|
+
border-right: 1px solid var(--border-2);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.content {
|
|
219
|
+
flex: 1;
|
|
220
|
+
padding: 2rem;
|
|
221
|
+
overflow-y: auto;
|
|
222
|
+
}
|
|
223
|
+
</style>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Blog Post Viewer
|
|
227
|
+
|
|
228
|
+
```vue
|
|
229
|
+
<script setup lang="ts">
|
|
230
|
+
import { ref, computed } from "vue";
|
|
231
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
232
|
+
|
|
233
|
+
interface BlogPost {
|
|
234
|
+
id: string;
|
|
235
|
+
title: string;
|
|
236
|
+
content: string;
|
|
237
|
+
author: string;
|
|
238
|
+
publishedAt: string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const currentPost = ref<BlogPost>({
|
|
242
|
+
id: "1",
|
|
243
|
+
title: "Getting Started with Vue 3",
|
|
244
|
+
content: `
|
|
245
|
+
# Getting Started with Vue 3
|
|
246
|
+
|
|
247
|
+
Vue 3 introduces the **Composition API** which provides a more flexible way to organize component logic.
|
|
248
|
+
|
|
249
|
+
## Key Features
|
|
250
|
+
|
|
251
|
+
- **Composition API**: Better logic reuse and organization
|
|
252
|
+
- **Better TypeScript support**: Improved type inference
|
|
253
|
+
- **Performance improvements**: Faster rendering and smaller bundle size
|
|
254
|
+
- **Multiple root elements**: No more single root element requirement
|
|
255
|
+
|
|
256
|
+
## Basic Example
|
|
257
|
+
|
|
258
|
+
\`\`\`vue
|
|
259
|
+
<script setup lang="ts">
|
|
260
|
+
import { ref, computed } from 'vue'
|
|
261
|
+
|
|
262
|
+
const count = ref(0)
|
|
263
|
+
const doubled = computed(() => count.value * 2)
|
|
264
|
+
|
|
265
|
+
const increment = () => {
|
|
266
|
+
count.value++
|
|
267
|
+
}
|
|
268
|
+
</script>
|
|
269
|
+
|
|
270
|
+
<template>
|
|
271
|
+
<div>
|
|
272
|
+
<p>Count: {{ count }}</p>
|
|
273
|
+
<p>Doubled: {{ doubled }}</p>
|
|
274
|
+
<button @click="increment">Increment</button>
|
|
275
|
+
</div>
|
|
276
|
+
</template>
|
|
277
|
+
\`\`\`
|
|
278
|
+
|
|
279
|
+
## Conclusion
|
|
280
|
+
|
|
281
|
+
Vue 3 is a significant improvement over Vue 2, offering better developer experience and performance.
|
|
282
|
+
`,
|
|
283
|
+
author: "John Doe",
|
|
284
|
+
publishedAt: "2024-01-15"
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const formattedDate = computed(() => {
|
|
288
|
+
return new Date(currentPost.value.publishedAt).toLocaleDateString();
|
|
289
|
+
});
|
|
290
|
+
</script>
|
|
291
|
+
|
|
292
|
+
<template>
|
|
293
|
+
<article class="blog-post">
|
|
294
|
+
<header class="post-header">
|
|
295
|
+
<h1>{{ currentPost.title }}</h1>
|
|
296
|
+
<div class="post-meta">
|
|
297
|
+
<span class="author">By {{ currentPost.author }}</span>
|
|
298
|
+
<span class="date">{{ formattedDate }}</span>
|
|
299
|
+
</div>
|
|
300
|
+
</header>
|
|
301
|
+
|
|
302
|
+
<div class="post-content">
|
|
303
|
+
<MarkdownViewer :content="currentPost.content" />
|
|
304
|
+
</div>
|
|
305
|
+
</article>
|
|
306
|
+
</template>
|
|
307
|
+
|
|
308
|
+
<style module>
|
|
309
|
+
.blog-post {
|
|
310
|
+
max-width: 800px;
|
|
311
|
+
margin: 0 auto;
|
|
312
|
+
padding: 2rem;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.post-header {
|
|
316
|
+
margin-bottom: 2rem;
|
|
317
|
+
padding-bottom: 1rem;
|
|
318
|
+
border-bottom: 1px solid var(--border-2);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.post-header h1 {
|
|
322
|
+
margin: 0 0 1rem 0;
|
|
323
|
+
color: var(--text-primary);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.post-meta {
|
|
327
|
+
display: flex;
|
|
328
|
+
gap: 1rem;
|
|
329
|
+
color: var(--text-secondary);
|
|
330
|
+
font-size: 0.9rem;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.post-content {
|
|
334
|
+
line-height: 1.6;
|
|
335
|
+
}
|
|
336
|
+
</style>
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Code Documentation with Custom Styling
|
|
340
|
+
|
|
341
|
+
```vue
|
|
342
|
+
<script setup lang="ts">
|
|
343
|
+
import { ref } from "vue";
|
|
344
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
345
|
+
|
|
346
|
+
const apiDocumentation = ref(`
|
|
347
|
+
# API Reference
|
|
348
|
+
|
|
349
|
+
## Authentication
|
|
350
|
+
|
|
351
|
+
All API requests require authentication using a Bearer token.
|
|
352
|
+
|
|
353
|
+
\`\`\`bash
|
|
354
|
+
curl -H "Authorization: Bearer YOUR_TOKEN" \\
|
|
355
|
+
https://api.example.com/users
|
|
356
|
+
\`\`\`
|
|
357
|
+
|
|
358
|
+
## Endpoints
|
|
359
|
+
|
|
360
|
+
| Method | Endpoint | Description |
|
|
361
|
+
|--------|----------|-------------|
|
|
362
|
+
| GET | /users | List all users |
|
|
363
|
+
| POST | /users | Create a new user |
|
|
364
|
+
| GET | /users/:id | Get user by ID |
|
|
365
|
+
| PUT | /users/:id | Update user |
|
|
366
|
+
| DELETE | /users/:id | Delete user |
|
|
367
|
+
|
|
368
|
+
## Response Format
|
|
369
|
+
|
|
370
|
+
All responses follow this format:
|
|
371
|
+
|
|
372
|
+
\`\`\`json
|
|
373
|
+
{
|
|
374
|
+
"success": true,
|
|
375
|
+
"data": {
|
|
376
|
+
"id": "123",
|
|
377
|
+
"name": "John Doe",
|
|
378
|
+
"email": "john@example.com"
|
|
379
|
+
},
|
|
380
|
+
"message": "User retrieved successfully"
|
|
381
|
+
}
|
|
382
|
+
\`\`\`
|
|
383
|
+
|
|
384
|
+
> **Note**: All timestamps are in ISO 8601 format (UTC).
|
|
385
|
+
`);
|
|
386
|
+
|
|
387
|
+
// Custom styling for API documentation
|
|
388
|
+
const customStyles = `
|
|
389
|
+
.api-docs {
|
|
390
|
+
--markdownviewer-code-block-bg: #f8f9fa;
|
|
391
|
+
--markdownviewer-code-block-border: #e9ecef;
|
|
392
|
+
--markdownviewer-table-th-bg: #f1f3f4;
|
|
393
|
+
--markdownviewer-blockquote-border: #007bff;
|
|
394
|
+
}
|
|
395
|
+
`;
|
|
396
|
+
</script>
|
|
397
|
+
|
|
398
|
+
<template>
|
|
399
|
+
<div class="api-documentation">
|
|
400
|
+
<style v-html="customStyles"></style>
|
|
401
|
+
|
|
402
|
+
<div class="api-docs">
|
|
403
|
+
<MarkdownViewer :content="apiDocumentation" />
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</template>
|
|
407
|
+
|
|
408
|
+
<style module>
|
|
409
|
+
.api-documentation {
|
|
410
|
+
padding: 2rem;
|
|
411
|
+
background: var(--background-1);
|
|
412
|
+
min-height: 100vh;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.api-docs {
|
|
416
|
+
max-width: 1000px;
|
|
417
|
+
margin: 0 auto;
|
|
418
|
+
background: var(--background-2);
|
|
419
|
+
padding: 2rem;
|
|
420
|
+
border-radius: 8px;
|
|
421
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
422
|
+
}
|
|
423
|
+
</style>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Interactive Markdown Editor
|
|
427
|
+
|
|
428
|
+
```vue
|
|
429
|
+
<script setup lang="ts">
|
|
430
|
+
import { ref, computed } from "vue";
|
|
431
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
432
|
+
|
|
433
|
+
const markdownInput = ref(`# Markdown Editor
|
|
434
|
+
|
|
435
|
+
Type your markdown here and see it rendered in real-time!
|
|
436
|
+
|
|
437
|
+
## Features
|
|
438
|
+
|
|
439
|
+
- **Bold text**
|
|
440
|
+
- *Italic text*
|
|
441
|
+
- \`inline code\`
|
|
442
|
+
- [Links](https://example.com)
|
|
443
|
+
|
|
444
|
+
### Code Block
|
|
445
|
+
|
|
446
|
+
\`\`\`javascript
|
|
447
|
+
function greet(name) {
|
|
448
|
+
return \`Hello, \${name}!\`;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
console.log(greet("World"));
|
|
452
|
+
\`\`\`
|
|
453
|
+
|
|
454
|
+
### List
|
|
455
|
+
|
|
456
|
+
1. First item
|
|
457
|
+
2. Second item
|
|
458
|
+
3. Third item
|
|
459
|
+
|
|
460
|
+
> This is a blockquote
|
|
461
|
+
`);
|
|
462
|
+
|
|
463
|
+
const wordCount = computed(() => {
|
|
464
|
+
return markdownInput.value.split(/\s+/).filter((word) => word.length > 0)
|
|
465
|
+
.length;
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
const characterCount = computed(() => {
|
|
469
|
+
return markdownInput.value.length;
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
const clearContent = () => {
|
|
473
|
+
markdownInput.value = "";
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
const insertTemplate = () => {
|
|
477
|
+
markdownInput.value = `# New Document
|
|
478
|
+
|
|
479
|
+
## Introduction
|
|
480
|
+
|
|
481
|
+
Write your content here...
|
|
482
|
+
|
|
483
|
+
## Code Example
|
|
484
|
+
|
|
485
|
+
\`\`\`typescript
|
|
486
|
+
// Your code here
|
|
487
|
+
\`\`\`
|
|
488
|
+
|
|
489
|
+
## Conclusion
|
|
490
|
+
|
|
491
|
+
Your conclusion here.
|
|
492
|
+
`;
|
|
493
|
+
};
|
|
494
|
+
</script>
|
|
495
|
+
|
|
496
|
+
<template>
|
|
497
|
+
<div class="markdown-editor">
|
|
498
|
+
<div class="editor-header">
|
|
499
|
+
<h2>Markdown Editor</h2>
|
|
500
|
+
<div class="stats">
|
|
501
|
+
<span>{{ wordCount }} words</span>
|
|
502
|
+
<span>{{ characterCount }} characters</span>
|
|
503
|
+
</div>
|
|
504
|
+
<div class="actions">
|
|
505
|
+
<button @click="clearContent" class="btn btn-secondary">Clear</button>
|
|
506
|
+
<button @click="insertTemplate" class="btn btn-primary">
|
|
507
|
+
Template
|
|
508
|
+
</button>
|
|
509
|
+
</div>
|
|
510
|
+
</div>
|
|
511
|
+
|
|
512
|
+
<div class="editor-layout">
|
|
513
|
+
<div class="input-panel">
|
|
514
|
+
<h3>Markdown Input</h3>
|
|
515
|
+
<textarea
|
|
516
|
+
v-model="markdownInput"
|
|
517
|
+
class="markdown-textarea"
|
|
518
|
+
placeholder="Type your markdown here..."
|
|
519
|
+
></textarea>
|
|
520
|
+
</div>
|
|
521
|
+
|
|
522
|
+
<div class="preview-panel">
|
|
523
|
+
<h3>Preview</h3>
|
|
524
|
+
<div class="preview-content">
|
|
525
|
+
<MarkdownViewer :content="markdownInput" />
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
</template>
|
|
531
|
+
|
|
532
|
+
<style module>
|
|
533
|
+
.markdown-editor {
|
|
534
|
+
height: 100vh;
|
|
535
|
+
display: flex;
|
|
536
|
+
flex-direction: column;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.editor-header {
|
|
540
|
+
display: flex;
|
|
541
|
+
align-items: center;
|
|
542
|
+
justify-content: space-between;
|
|
543
|
+
padding: 1rem 2rem;
|
|
544
|
+
background: var(--background-2);
|
|
545
|
+
border-bottom: 1px solid var(--border-2);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.stats {
|
|
549
|
+
display: flex;
|
|
550
|
+
gap: 1rem;
|
|
551
|
+
color: var(--text-secondary);
|
|
552
|
+
font-size: 0.9rem;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.actions {
|
|
556
|
+
display: flex;
|
|
557
|
+
gap: 0.5rem;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.btn {
|
|
561
|
+
padding: 0.5rem 1rem;
|
|
562
|
+
border: none;
|
|
563
|
+
border-radius: 4px;
|
|
564
|
+
cursor: pointer;
|
|
565
|
+
font-size: 0.9rem;
|
|
566
|
+
transition: background-color 0.2s;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.btn-primary {
|
|
570
|
+
background: var(--accent);
|
|
571
|
+
color: white;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.btn-primary:hover {
|
|
575
|
+
background: var(--accent-hover);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.btn-secondary {
|
|
579
|
+
background: var(--control-2);
|
|
580
|
+
color: var(--text-1);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.btn-secondary:hover {
|
|
584
|
+
background: var(--control-3);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.editor-layout {
|
|
588
|
+
flex: 1;
|
|
589
|
+
display: flex;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.input-panel,
|
|
593
|
+
.preview-panel {
|
|
594
|
+
flex: 1;
|
|
595
|
+
display: flex;
|
|
596
|
+
flex-direction: column;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.input-panel {
|
|
600
|
+
border-right: 1px solid var(--border-2);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.input-panel h3,
|
|
604
|
+
.preview-panel h3 {
|
|
605
|
+
margin: 0;
|
|
606
|
+
padding: 1rem 2rem;
|
|
607
|
+
background: var(--background-3);
|
|
608
|
+
border-bottom: 1px solid var(--border-2);
|
|
609
|
+
font-size: 1rem;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
.markdown-textarea {
|
|
613
|
+
flex: 1;
|
|
614
|
+
padding: 1rem 2rem;
|
|
615
|
+
border: none;
|
|
616
|
+
outline: none;
|
|
617
|
+
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
|
618
|
+
font-size: 14px;
|
|
619
|
+
line-height: 1.5;
|
|
620
|
+
background: var(--background-1);
|
|
621
|
+
color: var(--text-1);
|
|
622
|
+
resize: none;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.preview-content {
|
|
626
|
+
flex: 1;
|
|
627
|
+
padding: 1rem 2rem;
|
|
628
|
+
overflow-y: auto;
|
|
629
|
+
background: var(--background-1);
|
|
630
|
+
}
|
|
631
|
+
</style>
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### Readme Viewer with Custom Theme
|
|
635
|
+
|
|
636
|
+
```vue
|
|
637
|
+
<script setup lang="ts">
|
|
638
|
+
import { ref } from "vue";
|
|
639
|
+
import { MarkdownViewer } from "@umbra-ui/core";
|
|
640
|
+
|
|
641
|
+
const readmeContent = ref(`
|
|
642
|
+
# My Awesome Project
|
|
643
|
+
|
|
644
|
+
[](https://opensource.org/licenses/MIT)
|
|
645
|
+
[](https://travis-ci.org/user/repo)
|
|
646
|
+
|
|
647
|
+
A fantastic project that does amazing things!
|
|
648
|
+
|
|
649
|
+
## 🚀 Features
|
|
650
|
+
|
|
651
|
+
- ⚡ **Fast**: Built for performance
|
|
652
|
+
- 🎨 **Beautiful**: Modern UI design
|
|
653
|
+
- 🔧 **Configurable**: Highly customizable
|
|
654
|
+
- 📱 **Responsive**: Works on all devices
|
|
655
|
+
|
|
656
|
+
## 📦 Installation
|
|
657
|
+
|
|
658
|
+
\`\`\`bash
|
|
659
|
+
npm install my-awesome-project
|
|
660
|
+
\`\`\`
|
|
661
|
+
|
|
662
|
+
## 🎯 Quick Start
|
|
663
|
+
|
|
664
|
+
\`\`\`typescript
|
|
665
|
+
import { AwesomeProject } from 'my-awesome-project';
|
|
666
|
+
|
|
667
|
+
const project = new AwesomeProject({
|
|
668
|
+
theme: 'dark',
|
|
669
|
+
animations: true
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
project.start();
|
|
673
|
+
\`\`\`
|
|
674
|
+
|
|
675
|
+
## 📖 API Reference
|
|
676
|
+
|
|
677
|
+
### \`AwesomeProject(options)\`
|
|
678
|
+
|
|
679
|
+
Creates a new instance of AwesomeProject.
|
|
680
|
+
|
|
681
|
+
| Parameter | Type | Default | Description |
|
|
682
|
+
|-----------|------|---------|-------------|
|
|
683
|
+
| \`theme\` | \`string\` | \`'light'\` | Theme to use |
|
|
684
|
+
| \`animations\` | \`boolean\` | \`true\` | Enable animations |
|
|
685
|
+
|
|
686
|
+
## 🤝 Contributing
|
|
687
|
+
|
|
688
|
+
1. Fork the repository
|
|
689
|
+
2. Create your feature branch (\`git checkout -b feature/amazing-feature\`)
|
|
690
|
+
3. Commit your changes (\`git commit -m 'Add amazing feature'\`)
|
|
691
|
+
4. Push to the branch (\`git push origin feature/amazing-feature\`)
|
|
692
|
+
5. Open a Pull Request
|
|
693
|
+
|
|
694
|
+
## 📄 License
|
|
695
|
+
|
|
696
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
697
|
+
|
|
698
|
+
## 🙏 Acknowledgments
|
|
699
|
+
|
|
700
|
+
- Thanks to all contributors
|
|
701
|
+
- Inspired by the community
|
|
702
|
+
- Built with ❤️
|
|
703
|
+
`);
|
|
704
|
+
|
|
705
|
+
// Custom theme for readme styling
|
|
706
|
+
const readmeTheme = `
|
|
707
|
+
.readme-theme {
|
|
708
|
+
--markdownviewer-header-color: #2d3748;
|
|
709
|
+
--markdownviewer-link-color: #3182ce;
|
|
710
|
+
--markdownviewer-link-hover-color: #2c5282;
|
|
711
|
+
--markdownviewer-code-block-bg: #f7fafc;
|
|
712
|
+
--markdownviewer-code-block-border: #e2e8f0;
|
|
713
|
+
--markdownviewer-table-th-bg: #edf2f7;
|
|
714
|
+
--markdownviewer-blockquote-border: #3182ce;
|
|
715
|
+
}
|
|
716
|
+
`;
|
|
717
|
+
</script>
|
|
718
|
+
|
|
719
|
+
<template>
|
|
720
|
+
<div class="readme-viewer">
|
|
721
|
+
<style v-html="readmeTheme"></style>
|
|
722
|
+
|
|
723
|
+
<div class="readme-theme">
|
|
724
|
+
<MarkdownViewer :content="readmeContent" />
|
|
725
|
+
</div>
|
|
726
|
+
</div>
|
|
727
|
+
</template>
|
|
728
|
+
|
|
729
|
+
<style module>
|
|
730
|
+
.readme-viewer {
|
|
731
|
+
max-width: 900px;
|
|
732
|
+
margin: 0 auto;
|
|
733
|
+
padding: 2rem;
|
|
734
|
+
background: var(--background-1);
|
|
735
|
+
min-height: 100vh;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
.readme-theme {
|
|
739
|
+
background: var(--background-2);
|
|
740
|
+
padding: 2rem;
|
|
741
|
+
border-radius: 12px;
|
|
742
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
743
|
+
}
|
|
744
|
+
</style>
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
## Features
|
|
748
|
+
|
|
749
|
+
### Syntax Highlighting
|
|
750
|
+
|
|
751
|
+
The MarkdownViewer includes comprehensive syntax highlighting for:
|
|
752
|
+
|
|
753
|
+
- **Languages**: TypeScript, JavaScript, Python, Java, C++, Go, Rust, and many more
|
|
754
|
+
- **Language Aliases**: Automatic mapping (e.g., `ts` → `typescript`, `js` → `javascript`)
|
|
755
|
+
- **Fallback**: Unsupported languages fall back to plain text
|
|
756
|
+
- **VS Code Theme**: Colors match VS Code's default theme for familiarity
|
|
757
|
+
|
|
758
|
+
### Copy to Clipboard
|
|
759
|
+
|
|
760
|
+
- **Automatic Enhancement**: Code blocks are automatically enhanced with copy buttons
|
|
761
|
+
- **Visual Feedback**: Copy button appears on hover with success animation
|
|
762
|
+
- **Icon Integration**: Uses @umbra-ui/icons for consistent iconography
|
|
763
|
+
- **Fallback Support**: Graceful fallback for browsers without clipboard API
|
|
764
|
+
|
|
765
|
+
### Responsive Design
|
|
766
|
+
|
|
767
|
+
- **Mobile Friendly**: Optimized for all screen sizes
|
|
768
|
+
- **Table Scrolling**: Tables scroll horizontally on small screens
|
|
769
|
+
- **Typography**: Responsive font sizes and spacing
|
|
770
|
+
- **Touch Support**: Optimized for touch interactions
|
|
771
|
+
|
|
772
|
+
### Accessibility
|
|
773
|
+
|
|
774
|
+
- **Semantic HTML**: Proper heading hierarchy and semantic elements
|
|
775
|
+
- **ARIA Labels**: Copy buttons include proper ARIA labels
|
|
776
|
+
- **Keyboard Navigation**: Full keyboard accessibility
|
|
777
|
+
- **Screen Reader Support**: Compatible with assistive technologies
|
|
778
|
+
|
|
779
|
+
## Performance
|
|
780
|
+
|
|
781
|
+
- **Lazy Rendering**: Content is rendered efficiently with Vue's reactivity
|
|
782
|
+
- **Optimized Parsing**: Uses marked.js for fast markdown parsing
|
|
783
|
+
- **Minimal Re-renders**: Only re-renders when content changes
|
|
784
|
+
- **Memory Efficient**: Proper cleanup of event listeners and DOM elements
|
|
785
|
+
|
|
786
|
+
## Browser Support
|
|
787
|
+
|
|
788
|
+
- **Modern Browsers**: Chrome 88+, Firefox 85+, Safari 14+, Edge 88+
|
|
789
|
+
- **Clipboard API**: Uses modern clipboard API with fallback
|
|
790
|
+
- **CSS Grid/Flexbox**: Requires modern CSS support
|
|
791
|
+
- **ES6+**: Requires modern JavaScript support
|
|
792
|
+
|
|
793
|
+
## Migration Notes
|
|
794
|
+
|
|
795
|
+
### From v1.x to v2.x
|
|
796
|
+
|
|
797
|
+
- Updated to use marked v5+ with new token signature
|
|
798
|
+
- Improved syntax highlighting with better language detection
|
|
799
|
+
- Enhanced copy button functionality with better error handling
|
|
800
|
+
- Updated CSS custom properties for better theming support
|
|
801
|
+
|
|
802
|
+
### Breaking Changes
|
|
803
|
+
|
|
804
|
+
- None in current version - fully backward compatible
|
|
805
|
+
|
|
806
|
+
## Troubleshooting
|
|
807
|
+
|
|
808
|
+
### Common Issues
|
|
809
|
+
|
|
810
|
+
**Syntax highlighting not working:**
|
|
811
|
+
|
|
812
|
+
- Ensure prismjs is properly installed and imported
|
|
813
|
+
- Check that language names are supported by Prism.js
|
|
814
|
+
- Verify that the language is correctly specified in code blocks
|
|
815
|
+
|
|
816
|
+
**Copy button not appearing:**
|
|
817
|
+
|
|
818
|
+
- Check browser console for JavaScript errors
|
|
819
|
+
- Ensure @umbra-ui/icons is properly installed
|
|
820
|
+
- Verify that the component is properly mounted
|
|
821
|
+
|
|
822
|
+
**Styling issues:**
|
|
823
|
+
|
|
824
|
+
- Check that theme.css is properly imported
|
|
825
|
+
- Verify CSS custom properties are defined
|
|
826
|
+
- Ensure proper CSS specificity for custom overrides
|
|
827
|
+
|
|
828
|
+
### Performance Tips
|
|
829
|
+
|
|
830
|
+
- Use `v-memo` for large markdown content that doesn't change often
|
|
831
|
+
- Consider virtual scrolling for very long documents
|
|
832
|
+
- Lazy load markdown content when possible
|
|
833
|
+
- Use `shallowRef` for content that doesn't need deep reactivity
|