Hi,
it strikes me that this <code></code> and <link=""></link> system is actually not particularly easier or clearer to use than normal HTML (? maybe i have misunderstood what you are trying to do?)
Why not just let the user enter plain HTML encoded text,- as it seems they will need to use similar but incompatible tags for your system anyway?
If it is necessary, then i would suspect that the best way to do this would be to run through line by line replacing your tags with HTML until you reach a <code> tag, then continue streaming the real HTML until you reach a </code> tag etc etc. This would be possible in a basic form using while loops.... it would be easier if you ensured that the tags were always at the start of the line first.
(ie replace <code> with \n<code> and </code> with \n</code> and the same with all of your custom tags)
If you are feeling clever (read insane🙂 then you could try using a java applet as a basic wysiwyg editor on a webpage - there may even be some prewritten applets to do this ?- , but that might be overkill.
cheers,
Stevo