Building compatibility for forest (LaTeX) diagrams

Hello,

I’m currently studying syntax (linguistics) and am switching between Joplin for verbal notes and paper for making diagrams. There is a lovely LaTeX package, forest, that is a fairly minimal bracketing system for making syntax trees. Ideally, I could make those trees live in class using the package in joplin.

Here’s a simple tree and its source:

\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage[linguistics]{forest}

\begin{document}

\begin{forest}
[TP
[DP
[De politieagent-en, roof]

]
[T$'$
[T [\emptyset] ]
[VP [V [bezócht]] [DP [mijn moeder., roof]]]
]
]
\end{forest}

\end{document}

What I would hope for as a target Joplin interface would be to just include:

\begin{forest}
[TP
[DP
[De politieagent-en, roof]

]
[T$'$
[T [\emptyset] ]
[VP [V [bezócht]] [DP [mijn moeder., roof]]]
]
]
\end{forest}

And have this code generate a tree in the output pdf. A similar display to the Rich Markdown method of displaying images would be great, although I recognize that that would be a much later priority.

I certainly would be open to a method that using different joplin-friendly start/end statements.

Another angle at the problem: I tried inputting the tree into Joplin directly to see the output (specifically, reduced code without the document begin/end statements enclosed by $$ $$) and got the error

KaTeX parse error: No such environment: forest at position 7: \begin{̲f̲o̲r̲e̲s̲t̲}̲ [TP [DP [De po…

Would it be possible to add forest as an environment to my instance’s KaTeX processor?

And to be more specific about the plugin angle I mentioned above: Does anyone know of a plugin aiming to do a diagram-generating process within KaTeX that I could reference as a starting point?

I do want to note that I recognize that it might just be too different with the distinctions between Katex and Latex. I just don’t really know a ton about the distinction and how it applies here.