Skip to content

darkone-linux/md2logseq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md2logseq

Converts standard Markdown to Logseq format: hierarchical bullet list compatible with Logseq [[page]] format.

Installation

cargo install --path .
# or, for local build without installing:
cargo build --release
# → binary in target/release/md2logseq

Usage

# From a file
md2logseq notes.md

# From stdin
cat notes.md | md2logseq

# Redirect to a file
md2logseq notes.md > notes_logseq.md

Transformations Applied

Source Markdown Generated Logseq
# Title - # Title
## Subtitle \t- ## Subtitle
Paragraph under h2 \t\t- Paragraph
--- / *** / <hr> (removed)
Blank line (removed, resets list context)
- item / * item / + item - item (at correct depth)
1. item / 2. item - item + logseq.order-list-type:: number
Paragraph followed by list List becomes child of paragraph
Code block ``` … ``` Grouped into a single item with continuation
Table Grouped into a single item with continuation

Hierarchy Rule

Source list depth is translated to Logseq tab levels. Hierarchy is always coherent: you can only go down one level at a time (a larger indentation in source = +1 tab, never +2).

Example

Input (notes.md) :

# A title
A paragraph
## A subtitle
A paragraph.
Another paragraph.
---
## Another subtitle
- An item
  - A sub-item
# A title
A paragraph with a bullet list following.
- Hello world
   - Sub-item
      1. numbered item 1
      2. numbered item 2...
   - Another sub-item

Output :

- # A title
	- A paragraph
	- ## A subtitle
		- A paragraph.
		- Another paragraph.
	- ## Another subtitle
		- An item
			- A sub-item
- # A title
	- A paragraph with a bullet list following.
		- Hello world
			- Sub-item
				- numbered item 1
				  logseq.order-list-type:: number
				- numbered item 2...
				  logseq.order-list-type:: number
			- Another sub-item

Tests

cargo test

About

Convert standard Markdown into Logseq format (hierarchical bullet lists with tabs).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors