Custom markdown links

Premium Function

Back to Index

Epsilon Notes has a component called "Compatibility Processor" (Compat Processor). It is used to convert some custom elements to standard Commonmark using regexes.

A regex (regular expression) is a special line that is used to search for certain patterns in the text. There are a lot of regex tutorials on internet.

Now, suppose you have notes, where a custom [[link]] is used and you would like Epsilon Notes to understand it as a [link][link.md]. This is where you could use the Compat Processor.

For that purpose, you need to create a .text file, for example my_processor.text and add regexes (regular expressions) and replacement lines to it in the format:


regex
replacement

[optional empty lines]

regex
replacement

// comment 


regex
replacement

Empty lines and lines starting with // are ignored in that file.

So, the regex to find parts that look like [[link]] is:

\[\[([^\n\]]+)\]\]

It means, the application should look for parts of the text startwing the [[, that have any letters except for Enter and ] one or more times, and that end with ]].

The replacement line should be:

[$1]($1.md)

The $1 part takes the part in the round brackets in the regex pattern (in our case, it is ([^\n\]]+)). The resulting replacement for a text part that looks like [[note]] will be [note](note.md).

So, in your my_processor.text you should write:

// This regex converts [[links]] to [links](links.md)

\[\[([^\n\]]+)\]\]
[$1]($1.md)

After writing these regex and replacement lines in the file my_processor.text, go to the File Manager on the right and make a long tap on the my_processor.text file.

You will be proposed a few actions. Choose: Filename to Clipboard option.

Then, go to the Menu - Preferences - Compatibility Processor, and paste the filename from the Clipboard to the input window. It should paste the path to your my_processor.text file and should look like file:///storage/emulated/0/Notes/options/my_processor.text.

Et voila! Now, when you open files, all your [[links]] will be replaced with [links](link.md) during the rendering.

Note: Compatibility Processor does not change your text in the file. It changes the text only in the memory right before showing you the text.

Back to Index