@theblackswitch/yamp
v0.3.1
Published
YAMP: yet another markdown parser, A lightweight markdown parser specifically designed for live in-text parsing
Maintainers
Readme
Introduction
YAMP is a lightweight markdown parser focused on live in-text parsing. It's designed for Infill a live in-text mardown editor.
It comes with all basic markdown syntax plus built-in char map generation which maps each character in the visible html and traces it back to the original markdown.
Since it's designed for in-text parsing, the parser doesn't closely follow the CommonMark specifications as they aren't always intuitive for an in-text editor. Most of these are fully intended to improve the end-user experience.
Take a look at the wiki for development information!
Table of contents
Design
The project is designed in such a way that it's both really easy to extend and create custom syntax whilst parsing within microseconds!
Pros:
- Configurable
- Extensable
- High performance due to extensive caching and single-pass parsing
- Simplicty (outside of caching)
Cons:
- Doesn't closely match common mark
Features
All features below can be turned on / off. Some of them may even have some more options.
Standard markdown syntax
- Headers
# header 1
### header 3- Alternate Headers
Header 1
========- Block Quotes
> Block Quotes- Emphasis
*italic* **bold** ***both***- Underscore Emphasis
_italic_ __bold__ ___both___- Lists
- unordered
- sublists
1. ordered
2. sub lists
- merged
1. ordered
- unordered- Code
`code` `` `escaped` ``- Links
[My Website](https://theblackswitch.com "This is a title")- Images
- Horizontal Rules
---
***
___Extended markdown syntax
- Strikethrough
This parser is really ~~bad~~ awesome!- Github Style Codeblocks
\```js
conole.log('Hello World');
\```- Tables
| Product | Price | Provider | Delivery Date | Additional Notes |
|---------|--------|------------|---------------|-----------------------|
| Jeans | $34.99 | Jack&Jones | 4/08/2026 | Color: Blue |
| T-Shirt | $2.95 | Shein | 7/08/2026 | Child labour included |Infill Specific Syntax
- Colored text
Remeber to drink enough [blue|water] otherwise you'll be [#AAFFAA|Sick]!- Highlights
This is ^very^ important
These are escaped: ^^ ^<^ ^^- Underlined
This is ==also== importantExtras
Charmap generation: An array that maps each visible html character to their corresponding markdown character. This is useful for selecting / copying the correct underlying markdown characters
Escape incomplete HTML: Escapes any incomplete html. This includes unclosed tags
<div, faulty attributes<div class=">, lost close tags</div>, open tags without close tags<div>or even faulty html entities©This feature also makes sure the charmap is kept aligned when any text is getting parsed as HTML.[!TIP] Html currently cannot cross multiple lines. I should still fix this but it's a lot of work and isn't really that big of an issue since you can still use html on a single line
Replace spaces with
Yup this does exactly what you'd expect. Anyways this makes spaces actually stackAdd zero width spaces for cursors: This allows you to detect cursor positions easier. For example on empty lines, you can't detect cursor positions if there is no character there. This option will place a zero width space there so you can still click
📜License
YAMP © 2026 by theblackswitch is licensed under LGPL v3.0.
Additional condition: The content of this work, as a whole or in parts, may not be used for training, fine-tuning, or enhancement of artificial intelligence systems, machine learning models or any other type of program where computers use data and algorithms to learn patterns and make predictions without being explicitly programmed. This includes, not only and all, for commercial, non-commercial, educational, research, or personal projects.
