|
1 | | -# Enhanced `<mark>` <mark>elements</mark> <Badge type="warning" text="Beta" /> |
| 1 | +# Enhanced `<mark>` <mark>elements</mark> <Badge type="tip" text="v1.28.0" /> |
| 2 | + |
| 3 | +As an interesting little plugin, it adds a <mark>sliding animation</mark> to your `<mark>` highlighted elements. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +<div grid="~ cols-[auto_1fr] gap-1" items-center my-1> |
| 8 | + <span i-icon-park-outline:check-one text="green-600" /> |
| 9 | + <span>No JavaScripts</span> |
| 10 | + <span i-icon-park-outline:check-one text="green-600" /> |
| 11 | + <span>Stunning looking <mark>animations</mark></span> |
| 12 | + <span i-icon-park-outline:check-one text="green-600" /> |
| 13 | + <span>Multi-line supports</span> |
| 14 | + <span i-icon-park-outline:check-one text="green-600" /> |
| 15 | + <span>Day / Night theme (Dark mode) supported</span> |
| 16 | + <span i-icon-park-outline:check-one text="green-600" /> |
| 17 | + <span>Natively compatible with VitePress design</span> |
| 18 | +</div> |
| 19 | + |
| 20 | +::: info 🤔 Performance drop? No! |
| 21 | + |
| 22 | +This plugin doesn't contain any JavaScript code, only one stylesheet is provided. |
| 23 | + |
| 24 | +Therefore, it should be theoretically performant, and won't cause any page lag. |
2 | 25 |
|
3 | | -::: warning 🚧 Constructing |
4 | | -Nice to meet you! But sorry, this page is still under construction. If you don’t find the information you are interested in, you can first find the content you are interested in in the navigation in the sidebar to start reading. |
5 | 26 | ::: |
6 | 27 |
|
7 | | -This is a paragraph that contains <mark>highlighted text with a animated yellow background</mark>. |
| 28 | +## Take a look |
| 29 | + |
| 30 | +It works like this: |
| 31 | + |
| 32 | +Lorem ipsum dolor sit amet, <mark>consectetur adipiscing elit. Phasellus imperdiet augue ac est iaculis, sed laoreet leo sodales.</mark> Curabitur varius elit sed semper vehicula. Fusce luctus velit vel lacinia sagittis. Nullam sed nisl dictum augue accumsan placerat accumsan sed libero. Morbi aliquam felis id sem sollicitudin, <mark>sit amet convallis velit fermentum. Ut hendrerit leo sodales, placerat nibh ac, consequat purus.</mark> Integer turpis dui, viverra id nunc vestibulum, condimentum ultrices arcu. |
| 33 | + |
| 34 | +Or in blockquotes: |
| 35 | + |
| 36 | +> Lorem ipsum dolor sit amet, <mark>consectetur adipiscing elit. Phasellus imperdiet augue ac est iaculis, sed laoreet leo sodales.</mark> Curabitur varius elit sed semper vehicula. Fusce luctus velit vel lacinia sagittis. Nullam sed nisl dictum augue accumsan placerat accumsan sed libero. Morbi aliquam felis id sem sollicitudin, <mark>sit amet convallis velit fermentum. Ut hendrerit leo sodales, placerat nibh ac, consequat purus.</mark> Integer turpis dui, viverra id nunc vestibulum, condimentum ultrices arcu. |
| 37 | +
|
| 38 | +## Installation |
| 39 | + |
| 40 | +Install `@nolebase/vitepress-plugin-enhanced-mark` to your project dependencies by running the following command: |
| 41 | + |
| 42 | +::: code-group |
| 43 | + |
| 44 | +```shell [@antfu/ni] |
| 45 | +ni @nolebase/vitepress-plugin-enhanced-mark -D |
| 46 | +``` |
| 47 | + |
| 48 | +```shell [pnpm] |
| 49 | +pnpm add @nolebase/vitepress-plugin-enhanced-mark -D |
| 50 | +``` |
| 51 | + |
| 52 | +```shell [npm] |
| 53 | +npm install @nolebase/vitepress-plugin-enhanced-mark -D |
| 54 | +``` |
| 55 | + |
| 56 | +```shell [yarn] |
| 57 | +yarn add @nolebase/vitepress-plugin-enhanced-mark -D |
| 58 | +``` |
| 59 | + |
| 60 | +::: |
| 61 | + |
| 62 | +## Configuration |
| 63 | + |
| 64 | +In VitePress's [**theme configuration file**](https://vitepress.dev/reference/default-theme-config#default-theme-config) (note that it's not a **configuration file**, it's usually located at `docs/.vitepress/theme/index.ts`, file paths and extensions may be vary), **import the enhanced mark style**: |
| 65 | + |
| 66 | +<!--@include: @/pages/en/snippets/details-colored-diff.md--> |
| 67 | + |
| 68 | +::: code-group |
| 69 | + |
| 70 | +```typescript twoslash [.vitepress/theme/index.ts] |
| 71 | +import { h } from 'vue' |
| 72 | +import DefaultTheme from 'vitepress/theme' |
| 73 | +import type { Theme as ThemeConfig } from 'vitepress' |
| 74 | + |
| 75 | +import '@nolebase/vitepress-plugin-enhanced-mark/client/style.css' // [!code ++] |
| 76 | +
|
| 77 | +export const Theme: ThemeConfig = { |
| 78 | + extends: DefaultTheme, |
| 79 | + Layout: () => { |
| 80 | + // other configurations... |
| 81 | + }, |
| 82 | + enhanceApp({ app }) { |
| 83 | + // other configurations... |
| 84 | + }, |
| 85 | +} |
| 86 | + |
| 87 | +export default Theme |
| 88 | +``` |
| 89 | + |
| 90 | +::: |
0 commit comments