Obsidian plugin that converts ASCII to Unicode typography
Go to file
Kianga 6b003e9cc9
Ignore text inside code blocks
Fixes #1
2023-07-14 14:43:50 +02:00
.editorconfig Initial commit 2023-05-20 09:21:16 +02:00
.eslintignore Initial commit 2023-05-20 09:21:16 +02:00
.eslintrc Initial commit 2023-05-20 09:21:16 +02:00
.gitignore Initial commit 2023-05-20 09:21:16 +02:00
.npmrc Initial commit 2023-05-20 09:21:16 +02:00
LICENSE.md Add MIT license 2023-05-21 16:19:35 +02:00
README.md Add build instructions 2023-05-21 16:01:18 +02:00
esbuild.config.mjs Initial commit 2023-05-20 09:21:16 +02:00
main.ts Ignore text inside code blocks 2023-07-14 14:43:50 +02:00
manifest.json Ignore text inside code blocks 2023-07-14 14:43:50 +02:00
package-lock.json Import code 2023-05-20 10:47:27 +02:00
package.json Ignore text inside code blocks 2023-07-14 14:43:50 +02:00
tsconfig.json Initial commit 2023-05-20 09:21:16 +02:00
version-bump.mjs Initial commit 2023-05-20 09:21:16 +02:00
versions.json Initial commit 2023-05-20 09:21:16 +02:00

README.md

Auto-Typography for Obsidian

This is a simple plugin for Obsidian that converts ASCII typography to the correct Unicode symbols for English writing, similar to the original SmartyPants plugin by John Gruber.

Text is replaced in reading mode only. This plugin does not interfere during editing or in live-preview mode, and Markdown files are never modified.

Rules

  • Convert double hyphens -- to en-dash
  • Convert triple hyphens --- to em-dash
  • Convert triple periods ... to horizonal ellipsis
  • Convert single apostrophe ' in the middle of a word to a right single quotation mark
  • Convert single ASCII quotes ' around words to left and right single quotation marks and
  • Convert double ASCII quotes " around words to left and right double quotation marks and

Notes

This is my first Obsidian plugin; I made it for practice and for my personal use and it's intentionally simple. There is currently no configuration, and no support for other languages or different kinds of quotation marks. More features might be added in the future.

The plugin registers a MarkdownPostProcessor and affects text nodes in the rendered DOM tree only; this should prevent it from interfering with other plugins by replacing CSS classes or HTML attributes by accident.

Development

NodeJS 18.16.0 LTS is required for development.

After checkout, run npm install to fetch dependencies. npm run build to compile, then copy manifest.json and main.js to VAULT/.obsidian/plugins/obsidian-auto-typography/ to install and enable the plugin under Settings - Community Plugins.