Dealing with long strings in a templater template

Hello! Appologies for my lack of JS knowledge, but I am trying to finish up my chess notes workflow and this is the last step for me.

My goal is to use tp.system.prompt() twice to take in two values. One will be the PGN , a list of moves that looks like this:

“1. Nf3 d5 2. c4 e6 3. d4 c6 4. Nc3 Nf6 5. Bg5 h6 6. Bf4 Qd6 7. Bxd6 Bxd6 8. cxd5”

then the other will be a list of FEN’s, a notation used to keep track of the board state, for each individual move. I am getting them from a converter I have iframed into my note and when copied, they look like this:

rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq - 1 1
rnbqkbnr/ppp1pppp/8/3p4/8/5N2/PPPPPPPP/RNBQKB1R w KQkq d6 0 2
rnbqkbnr/ppp1pppp/8/3p4/2P5/5N2/PP1PPPPP/RNBQKB1R b KQkq c3 0 2
rnbqkbnr/ppp2ppp/4p3/3p4/2P5/5N2/PP1PPPPP/RNBQKB1R w KQkq - 0 3
rnbqkbnr/ppp2ppp/4p3/3p4/2PP4/5N2/PP2PPPP/RNBQKB1R b KQkq d3 0 3
rnbqkbnr/pp3ppp/2p1p3/3p4/2PP4/5N2/PP2PPPP/RNBQKB1R w KQkq - 0 4
rnbqkbnr/pp3ppp/2p1p3/3p4/2PP4/2N2N2/PP2PPPP/R1BQKB1R b KQkq - 1 4
rnbqkb1r/pp3ppp/2p1pn2/3p4/2PP4/2N2N2/PP2PPPP/R1BQKB1R w KQkq - 2 5
rnbqkb1r/pp3ppp/2p1pn2/3p2B1/2PP4/2N2N2/PP2PPPP/R2QKB1R b KQkq - 3 5
rnbqkb1r/pp3pp1/2p1pn1p/3p2B1/2PP4/2N2N2/PP2PPPP/R2QKB1R w KQkq - 0 6
rnbqkb1r/pp3pp1/2p1pn1p/3p4/2PP1B2/2N2N2/PP2PPPP/R2QKB1R b KQkq - 1 6
rnb1kb1r/pp3pp1/2pqpn1p/3p4/2PP1B2/2N2N2/PP2PPPP/R2QKB1R w KQkq - 2 7
rnb1kb1r/pp3pp1/2pBpn1p/3p4/2PP4/2N2N2/PP2PPPP/R2QKB1R b KQkq - 0 7
rnb1k2r/pp3pp1/2pbpn1p/3p4/2PP4/2N2N2/PP2PPPP/R2QKB1R w KQkq - 0 8
rnb1k2r/pp3pp1/2pbpn1p/3P4/3P4/2N2N2/PP2PPPP/R2QKB1R b KQkq - 0 8

Basically my goal is to have templater take in these two inputs, and output what will simply be the pgn (1. d4 d5 2. Nf6 Nc3 …ect) with each move matched with its corresponding FEN so that it refers to my notes on the position. In markdown, it would look like this:

  1. [[rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq - 1 1|Nf3]] [[rnbqkbnr/ppp1pppp/8/3p4/8/5N2/PPPPPPPP/RNBQKB1R w KQkq d6 0 2|d5]]

… and so on. The moves themselves being the alias for the boardstate that they refer to in this situation

I’ve been looking into how to handle strings in JS as I’m assuming that is what I will need to use, but I feel very lost and confused, and honestly just want to get this last step done without learning a whole programming language.

Any help would be greatly appreciated!! Thanks!

Knowing little about chess, I can’t make sense of this spec. Can you explain by maybe using colors and showing what matches with what?