Markdown Indexer
Run this over a directory of markdown files to generate a set of URL shortcut links for them that can be indexed by a program such as KeyPirinha.
Will read each file and create an anchor based shortcuts for each heading too.
Build
Get source and build project.
cd '/path/to/projects'
git clone git@github.com:robertmarkbram/Markdown-Indexer.git
cd Markdown-Indexer
export JAVA_HOME="C:\Program Files\Java\jdk-15"
export PATH="$JAVA_HOME/bin:$PATH"
./gradlew clean build
Create an environment specific properties file
cp src/main/resources/application.properties build/libs/application-${hostname}.properties
Modify paths in that properties file to suit your environment.
Run it.
# Assume you have JDK 15 on the path already.
cd '/path/to/projects/Markdown-Indexer/build/libs'
java -jar -Dspring.profiles.active=${hostname} Markdown-Indexer-0.0.1-SNAPSHOT.jar
Replacement Sequence files
Default replacement sequence files:
markdown-file-replacement-sequence.txt
- Used to process the path to a markdown file and will output the URL file name.
markdown-heading-replacement-sequence.txt
- Used to process headings within markdown files and will output the URL file name.
Notes about these files.
-
The listed files above are defaults only. You can override them by providing your own path to them in the properties file.
-
The only lines that matter are those that start with one of these
find= replace=
All other lines are ignore. It looks like I am using comments here (lines starting with #). That's just a way to visually delineate these lines from all the others.
-
Don't trim trailing spaces. They are important.
-
End a line with these three characters if you do want to trim trailing space - these characters will be removed:
;;;
-
Find and replace sections are regular expressions as per the Pattern.java class.
-
Backslash
\
does need to be escaped if you need a literal backslash, i.e.\\
but other escape sequences for Java regex isn't needed here because you are not writing Java code, but text that Java will read literally.
Notes about Java Regex: