Skip to main content

@mdit/plugin-align


Plugin to align contents.

Note

This plugin is based on @mdit/plugin-container.

Usage

TS
import MarkdownIt from "markdown-it";
import { align } from "@mdit/plugin-align";

const mdIt = MarkdownIt().use(align);

mdIt.render(`\
::: center
Contents to align center
:::
`);

Syntax

::: left
Contents to align left
:::

::: center
Contents to align center
:::

::: right
Contents to align right
:::

::: justify
Contents to align justify
:::

Nesting and escaping

  • Nestings can be done by increasing marker number of outer container:

    :::: center
    Center contents...
    ::: left
    Left contents..
    :::
    Center contents...
    ::::
    

    will be

    Center contents...

    Left contents..

    Center contents...

  • Escaping can be done by adding \ to escape the marker:

    \::: left
    
    :::
    

    will be

    ::: left

    :::

Demo

Demo

Twinkle, Twinkle, Little Star

——Jane Taylor

Twinkle, twinkle, little star,

How I wonder what you are!

Up above the world so high,

Like a diamond in the sky.

When the blazing sun is gone,

When he nothing shines upon,

Then you show your little light,

Twinkle, twinkle, all the night.

Then the traveller in the dark,

Thanks you for your tiny spark,

He could not see which way to go,

If you did not twinkle so.

In the dark blue sky you keep,

And often thro' my curtains peep,

For you never shut your eye,

Till the sun is in the sky.

'Tis your bright and tiny spark,

Lights the trav’ller in the dark,

Tho' I know not what you are,

Twinkle, twinkle, little star.

:::: center

### Twinkle, Twinkle, Little Star

::: right

——Jane Taylor

:::

Twinkle, twinkle, little star,

How I wonder what you are!

Up above the world so high,

Like a diamond in the sky.

When the blazing sun is gone,

When he nothing shines upon,

Then you show your little light,

Twinkle, twinkle, all the night.

Then the traveller in the dark,

Thanks you for your tiny spark,

He could not see which way to go,

If you did not twinkle so.

In the dark blue sky you keep,

And often thro' my curtains peep,

For you never shut your eye,

Till the sun is in the sky.

'Tis your bright and tiny spark,

Lights the trav’ller in the dark,

Tho' I know not what you are,

Twinkle, twinkle, little star.

::::