GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - harttle/md-padding: AST-based padding for Markdown and natural language, improving readability in multilingual documents. Supports Vim and VSCode.

BranchesTags
Open more actions menu

Latest commit

 

History

86 Commits
86 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
demo
demo
 
 
docs
docs
 
 
src
src
 
 
test
test
 
 
.babelrc.js
.babelrc.js
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
README.md
README.md
 
 
README.zh.md
README.zh.md
 
 
jest.config.js
jest.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

Markdown Padding

npm version downloads Check Release Coveralls GitHub issues DUB license

English | 简体中文

A tool for formatting Markdown content with padding.

  • Ensures consistent spacing before and after Markdown elements like headings, lists, and code blocks.
  • Aligns tables by formatting column spacing properly.
  • Supports formatting inside code blocks and recognizes mathematical expressions, HTML elements, YAML front matter, and fenced code blocks for correct formatting.
  • Applies an extended AST parsing to ensure natural language structures like punctuations and latin characters are padded correctly.

Here's a change made by md-padding:

- # 如何中ArchLinux中安装X11?
+ # 如何中 ArchLinux 中安装 X11?

- 首先要安装ArchLinux,然后安装`xorg-server`软件包:
+ 首先要安装 ArchLinux,然后安装 `xorg-server` 软件包:

- 确保你的xorg-server版本已经足够高,比如>=1.20,然后安装**合适**的驱动:
+ 确保你的 xorg-server 版本已经足够高,比如 >= 1.20,然后安装 **合适** 的驱动:

- 如果你需要3D加速等新的功能,可能还需要安装*闭源驱动*。详情请参考[ArchWiki里的对应章节](https://wiki.archlinux.org/index.php/Xorg)。
+ 如果你需要 3D 加速等新的功能,可能还需要安装 *闭源驱动*。详情请参考 [ArchWiki 里的对应章节](https://wiki.archlinux.org/index.php/Xorg)。

Command Line Interface

npx md-padding -i README.md   # fix the file in place
npx md-padding README.md      # output the fixed content

For more options:

> npx md-padding --help
md-padding [OPTION]... <FILE>

Options:
  --help, -h      Show help                  [boolean]
  --version       Show version number        [boolean]
  --in-place, -i  Edit file in place         [boolean]
  --ignore-words, -I  Ignore padding for specific words  [string]
  --ignore-patterns, -P  Ignore specific patterns using regex  [string]
  --read-files, -r    Read file list from input, one file per line  [string]

Examples:
  stdout    md-padding README.md
  in-place  md-padding -i README.md
  pipe      cat README.md | md-padding
  ignore-words  cat README.md | md-padding -I '=' '::'
  ignore-patterns  cat README.md | md-padding -P '=' ':+'
  batch format  cat list.txt | md-padding -r -i
  equivalent w/ md-padding -r list.txt -i

Vim Integration

Map the F6 key to format Markdown files:

" Hotkey for md-padding format
noremap <buffer> <F6> <Esc>:%!npx md-padding<CR>

VS Code Integration

Install the Markdown Padding extension.

  • Open Command Palette (Ctrl + Shift + P on Windows/Linux, Cmd + Shift + P on macOS) and run Markdown Padding.
  • Use the default formatting shortcut:
    • Shift + Alt + F (Windows)
    • Shift + Option + F (Mac)
    • Ctrl + Shift + I (Linux)

Configuration

Setting Type Description
mdpadding.ignoreWords Array<string> Words to exclude from padding adjustments
mdpadding.ignorePatterns Array<string> Regular expressions defining patterns to ignore

Q&A

How to ignore a specific section

You can exclude certain sections from formatting using the md-padding-ignore directive:

Some text before the ignored section.
<!--md-padding-ignore-begin-->
a*b=c, b>1 => a&lt;c
<!--md-padding-ignore-end-->
This text will be formatted as usual.

About

AST-based padding for Markdown and natural language, improving readability in multilingual documents. Supports Vim and VSCode.

harttle.land/md-padding/

Topics

astfixerlintermarkdownvimvscode-extension

Resources

Readme
Activity

Stars

65 stars

Watchers

1 watching

Forks

6 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.