Rules
YAML
Format Tags in YAML
Alias: format-tags-in-yaml
Remove Hashtags from tags in the YAML frontmatter, as they make the tags there invalid.
Example: Format Tags in YAML frontmatter
Before:
---
tags: #one #two #three #nested/four/five
---After:
---
tags: one two three nested/four/five
---Example: Format tags in array
Before:
---
tags: [#one #two #three]
---After:
---
tags: [one two three]
---Example: Format tags in list
Before:
---
tags:
- #tag1
- #tag2
---After:
---
tags:
- tag1
- tag2
---Insert YAML attributes
Alias: insert-yaml-attributes
Inserts the given YAML attributes into the YAML frontmatter. Put each attribute on a single line.
Options:
- Text to insert: Text to insert into the YAML frontmatter
- Default:
aliases: tags:
- Default:
Example: Insert static lines into YAML frontmatter. Text to insert: aliases: tags: doc animal: dog
Before:
---
animal: cat
---After:
---
aliases:
tags: doc
animal: cat
---YAML Timestamp
Alias: yaml-timestamp
Keep track of the date the file was last edited in the YAML front matter. Gets dates from file metadata.
Options:
- Date Created: Insert the file creation date
- Default:
true
- Default:
- Date Created Key: Which YAML key to use for creation date
- Default:
date created
- Default:
- Date Modified: Insert the date the file was last modified
- Default:
true
- Default:
- Date Modified Key: Which YAML key to use for modification date
- Default:
date modified
- Default:
- Format: Date format
- Default:
dddd, MMMM Do YYYY, h:mm:ss a
- Default:
Example: Adds a header with the date.
Before:
# H1After:
---
date created: Wednesday, January 1st 2020, 12:00:00 am
date modified: Thursday, January 2nd 2020, 12:00:00 am
---
# H1Example: dateCreated option is false
Before:
# H1After:
---
date modified: Wednesday, January 1st 2020, 12:00:00 am
---
# H1Example: Date Created Key is set
Before:
# H1After:
---
created: Wednesday, January 1st 2020, 12:00:00 am
---
# H1Example: Date Modified Key is set
Before:
# H1After:
---
modified: Wednesday, January 1st 2020, 12:00:00 am
---
# H1YAML Title
Alias: yaml-title
Inserts the title of the file into the YAML frontmatter. Gets the title from the first H1 or filename.
Options:
- Title Key: Which YAML key to use for title
- Default:
title
- Default:
Example: Adds a header with the title from heading.
Before:
# ObsidianAfter:
---
title: Obsidian
---
# ObsidianExample: Adds a header with the title.
Before:
After:
---
title: Filename
---
Heading
Header Increment
Alias: header-increment
Heading levels should only increment by one level at a time
Example:
Before:
# H1
### H3
### H3
#### H4
###### H6
We skipped a 2nd level headingAfter:
# H1
## H3
## H3
### H4
#### H6
We skipped a 2nd level headingFile Name Heading
Alias: file-name-heading
Inserts the file name as a H1 heading if no H1 heading exists.
Example: Inserts an H1 heading
Before:
This is a line of textAfter:
# File Name
This is a line of textExample: Inserts heading after YAML front matter
Before:
---
title: My Title
---
This is a line of textAfter:
---
title: My Title
---
# File Name
This is a line of textCapitalize Headings
Alias: capitalize-headings
Headings should be formatted with capitalization
Options:
- Style: The style of capitalization to use
- Default:
Title Case Title Case: Capitalize using title case rulesAll Caps: Capitalize the first letter of each wordFirst Letter: Only capitalize the first letter
- Default:
- Ignore Cased Words: Only apply title case style to words that are all lowercase
- Default:
true
- Default:
- Ignore Words: A comma separated list of words to ignore when capitalizing
- Default:
macOS, iOS, iPhone, iPad, JavaScript, TypeScript, AppleScript
- Default:
- Lowercase Words: A comma separated list of words to keep lowercase
- Default:
via, a, an, the, and, or, but, for, nor, so, yet, at, by, in, of, on, to, up, as, is, if, it, for, to, with, without, into, onto, per
- Default:
Example: With Title Case=true, Ignore Cased Words=false
Before:
# this is a heading 1
## THIS IS A HEADING 2
### a heading 3After:
# This is a Heading 1
## This is a Heading 2
### A Heading 3Example: With Title Case=true, Ignore Cased Words=true
Before:
# this is a heading 1
## THIS IS A HEADING 2
### a hEaDiNg 3After:
# This is a Heading 1
## THIS IS A HEADING 2
### A hEaDiNg 3Example: With First Letter=true
Before:
# this is a heading 1
## this is a heading 2After:
# This is a heading 1
## This is a heading 2Example: With All Caps=true
Before:
# this is a heading 1
## this is a heading 2After:
# THIS IS A HEADING 1
## THIS IS A HEADING 2Footnote
Move Footnotes to the bottom
Alias: move-footnotes-to-the-bottom
Move all footnotes to the bottom of the document.
Example: Moving footnotes to the bottom
Before:
Lorem ipsum, consectetur adipiscing elit. [^1] Donec dictum turpis quis ipsum pellentesque.
[^1]: first footnote
Quisque lorem est, fringilla sed enim at, sollicitudin lacinia nisi.[^2]
[^2]: second footnote
Maecenas malesuada dignissim purus ac volutpat.After:
Lorem ipsum, consectetur adipiscing elit. [^1] Donec dictum turpis quis ipsum pellentesque.
Quisque lorem est, fringilla sed enim at, sollicitudin lacinia nisi.[^2]
Maecenas malesuada dignissim purus ac volutpat.
[^1]: first footnote
[^2]: second footnoteRe-Index Footnotes
Alias: re-index-footnotes
Re-indexes footnote keys and footnote, based on the order of occurence (NOTE: This rule deliberately does not preserve the relation between key and footnote, to be able to re-index duplicate keys.)
Example: Re-indexing footnotes after having deleted previous footnotes
Before:
Lorem ipsum at aliquet felis.[^3] Donec dictum turpis quis pellentesque,[^5] et iaculis tortor condimentum.
[^3]: first footnote
[^5]: second footnoteAfter:
Lorem ipsum at aliquet felis.[^1] Donec dictum turpis quis pellentesque,[^2] et iaculis tortor condimentum.
[^1]: first footnote
[^2]: second footnoteExample: Re-indexing footnotes after inserting a footnote between
Before:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Aenean at aliquet felis. Donec dictum turpis quis ipsum pellentesque, et iaculis tortor condimentum.[^1a] Vestibulum nec blandit felis, vulputate finibus purus.[^2] Praesent quis iaculis diam.
[^1]: first footnote
[^1a]: third footnote, inserted later
[^2]: second footnotesAfter:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.[^1] Aenean at aliquet felis. Donec dictum turpis quis ipsum pellentesque, et iaculis tortor condimentum.[^2] Vestibulum nec blandit felis, vulputate finibus purus.[^3] Praesent quis iaculis diam.
[^1]: first footnote
[^2]: third footnote, inserted later
[^3]: second footnotesExample: Re-indexing duplicate footnote keys
Before:
Lorem ipsum at aliquet felis.[^1] Donec dictum turpis quis pellentesque,[^1] et iaculis tortor condimentum.
[^1]: first footnote
[^1]: second footnoteAfter:
Lorem ipsum at aliquet felis.[^1] Donec dictum turpis quis pellentesque,[^2] et iaculis tortor condimentum.
[^1]: first footnote
[^2]: second footnoteFootnote after Punctuation
Alias: footnote-after-punctuation
Ensures that footnote references are placed after punctuation, not before.
Example: Placing footnotes after punctuation.
Before:
Lorem[^1]. Ipsum[^2], doletes.After:
Lorem.[^1] Ipsum,[^2] doletes.Content
Remove Multiple Spaces
Alias: remove-multiple-spaces
Removes two or more consecutive spaces. Ignores spaces at the beginning and ending of the line.
Example: Removing double and triple space.
Before:
Lorem ipsum dolor sit amet.After:
Lorem ipsum dolor sit amet.Remove Hyphenated Line Breaks
Alias: remove-hyphenated-line-breaks
Removes hyphenated line breaks. Useful when pasting text from textbooks.
Example: Removing hyphenated line breaks.
Before:
This text has a linebr‐ eak.After:
This text has a linebreak.Remove Consecutive List Markers
Alias: remove-consecutive-list-markers
Removes consecutive list markers. Useful when copy-pasting list items.
Example: Removing consecutive list markers.
Before:
- item 1
- - copypasted item A
- item 2
- indented item
- - copypasted item BAfter:
- item 1
- copypasted item A
- item 2
- indented item
- copypasted item BRemove Empty List Markers
Alias: remove-empty-list-markers
Removes empty list markers, i.e. list items without content.
Example: Removes empty list markers.
Before:
- item 1
-
- item 2After:
- item 1
- item 2Proper Ellipsis
Alias: proper-ellipsis
Replaces three consecutive dots with an ellipsis.
Example: Replacing three consecutive dots with an ellipsis.
Before:
Lorem (...) Impsum.After:
Lorem (…) Impsum.Spacing
Trailing spaces
Alias: trailing-spaces
Removes extra spaces after every line.
Options:
- Two Space Linebreak: Ignore two spaces followed by a line break ("Two Space Rule").
- Default:
false
- Default:
Example: Removes trailing spaces and tabs.
Before:
# H1
Line with trailing spaces and tabs. After:
# H1
Line with trailing spaces and tabs.Example: With Two Space Linebreak = true
Before:
# H1
Line with trailing spaces and tabs. After:
# H1
Line with trailing spaces and tabs. Heading blank lines
Alias: heading-blank-lines
All headings have a blank line both before and after (except where the heading is at the beginning or end of the document).
Options:
- Bottom: Insert a blank line after headings
- Default:
true
- Default:
Example: Headings should be surrounded by blank lines
Before:
# H1
## H2
# H1
line
## H2
After:
# H1
## H2
# H1
line
## H2Example: With Bottom=false
Before:
# H1
line
## H2
# H1
lineAfter:
# H1
line
## H2
# H1
lineParagraph blank lines
Alias: paragraph-blank-lines
All paragraphs should have exactly one blank line both before and after.
Example: Paragraphs should be surrounded by blank lines
Before:
# H1
Newlines are inserted.
A paragraph is a line that starts with a letter.After:
# H1
Newlines are inserted.
A paragraph is a line that starts with a letter.Space after list markers
Alias: space-after-list-markers
There should be a single space after list markers and checkboxes.
Example:
Before:
1. Item 1
2. Item 2
- [ ] Item 1
- [x] Item 2
- [ ] Item 3After:
1. Item 1
2. Item 2
- [ ] Item 1
- [x] Item 2
- [ ] Item 3Compact YAML
Alias: compact-yaml
Removes leading and trailing blank lines in the YAML front matter.
Example:
Before:
---
date: today
---After:
---
date: today
---Consecutive blank lines
Alias: consecutive-blank-lines
There should be at most one consecutive blank line.
Example:
Before:
Some text
Some more textAfter:
Some text
Some more textConvert Spaces to Tabs
Alias: convert-spaces-to-tabs
Converts leading spaces to tabs.
Options:
- Tabsize: Number of spaces that will be converted to a tab
- Default:
4
- Default:
Example: Converting spaces to tabs with tabsize = 3
Before:
- text with no indention
- text indented with 3 spaces
- text with no indention
- text indented with 6 spacesAfter:
- text with no indention
- text indented with 3 spaces
- text with no indention
- text indented with 6 spacesLine Break at Document End
Alias: line-break-at-document-end
Ensures that there is exactly one line break at the end of a document.
Example: Appending a line break to the end of the document.
Before:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.After:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Example: Removing trailing line breaks to the end of the document, except one.
Before:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
After:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Space between Chinese and English or numbers
Alias: space-between-chinese-and-english-or-numbers
Ensures that Chinese and English or numbers are separated by a single space. Follow this guidelines
Example: Space between Chinese and English
Before:
中文字符串english中文字符串。After:
中文字符串 english 中文字符串。Example: Space between Chinese and link
Before:
中文字符串[english](http://example.com)中文字符串。After:
中文字符串 [english](http://example.com) 中文字符串。Example: Space between Chinese and inline code block
Before:
中文字符串`code`中文字符串。After:
中文字符串 `code` 中文字符串。