0.1.0-alpha.29 • Published 11 months ago

@md-plugins/md-plugin-image v0.1.0-alpha.29

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@md-plugins/md-plugin-image

A Markdown-It plugin that enhances image rendering by adding customizable CSS classes. This allows for consistent styling and seamless integration into design systems, making it easy to apply specific layouts or effects to images.

Features

  • Adds a customizable CSS class to <img> elements.
  • Supports a default class that can be overridden via plugin options.
  • Enhances image styling and layout consistency.

Installation

Install the plugin via your preferred package manager:

# with pnpm:
pnpm add @md-plugins/md-plugin-image
# with Yarn:
yarn add @md-plugins/md-plugin-image
# with npm:
npm install @md-plugins/md-plugin-image

Usage

Basic Setup

import MarkdownIt from 'markdown-it'
import { imagePlugin } from '@md-plugins/md-plugin-image'

const md = new MarkdownIt()
md.use(imagePlugin, {
  imageClass: 'custom-image-class',
})

const markdownContent = `
![Alt text](example.jpg)
`

const renderedOutput = md.render(markdownContent)

console.log('Rendered Output:', renderedOutput)

Example Output

The rendered output will include the specified CSS class:

<img src="example.jpg" alt="Alt text" class="custom-image-class" />

Options

The md-plugin-image plugin supports the following options:

OptionTypeDefaultDescription
imageClassstring'markdown-image'CSS class to apply to all <img> tags

Testing

Run the tests to ensure the plugin behaves as expected:

pnpm test

Documentation

In case this README falls out of date, please refer to the documentation for the latest information.

License

This project is licensed under the MIT License. See the LICENSE file for details.

0.1.0-alpha.29

11 months ago

0.1.0-alpha.28

11 months ago

0.1.0-alpha.27

11 months ago

0.1.0-alpha.26

11 months ago

0.1.0-alpha.25

11 months ago

0.1.0-alpha.24

12 months ago

0.1.0-alpha.23

12 months ago

0.1.0-alpha.22

12 months ago

0.1.0-alpha.21

12 months ago

0.1.0-alpha.20

12 months ago

0.1.0-alpha.19

12 months ago

0.1.0-alpha.18

12 months ago

0.1.0-alpha.17

12 months ago

0.1.0-alpha.16

1 year ago

0.1.0-alpha.15

1 year ago

0.1.0-alpha.14

1 year ago

0.1.0-alpha.13

1 year ago

0.1.0-alpha.12

1 year ago

0.1.0-alpha.11

1 year ago

0.1.0-alpha.10

1 year ago

0.1.0-alpha.9

1 year ago

0.1.0-alpha.8

1 year ago

0.1.0-alpha.7

1 year ago

0.1.0-alpha.6

1 year ago

0.1.0-alpha.5

1 year ago

0.1.0-alpha.2

1 year ago

0.1.0-alpha.1

1 year ago