Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/imzbf/vite-plugin-import-markdown

Import markdown as a module
https://github.com/imzbf/vite-plugin-import-markdown

markdown vite

Last synced: about 1 month ago
JSON representation

Import markdown as a module

Awesome Lists containing this project

README

        

# @vavt/vite-plugin-import-markdown

Import markdown as a module.

## Usage

- Install

```shell
yarn add @vavt/vite-plugin-import-markdown
```

- Config

`vite.config.ts`

```ts
import { defineConfig } from 'vite';
import markdown from '@vavt/vite-plugin-import-markdown';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [markdown()],
});
```

`vite-env.d.ts`

```ts
declare module '*.md';
```

`file.ts`

```ts
import mdText from './text.md';

console.log('Source Text: ', mdText);
```