By Martin Stut, 2013-09-27
Every now and then, I need to document computer code, such as a configuration defined by text files, including snippets of code (2 - 30 lines) in the documentation. I do like using FreeMind as a fast editing tool to collect information and thoughts. But usually, nodes in mind maps are just keywords or text snippets with little formatting. So I was looking for a way to include multi-line code snippets in mind map nodes that require preserving line breaks and whitespace.
It turned out to be easier than I thought:
- Open the node, about to contain the file snippet, with the long text editor (Alt+enter).
- When asked whether you want to use formatting (bold, italic, etc.), click "yes". The editing window will open.
- Near the bottom of the editing windows, click on the HTML-code-view tab. You'll see plain HTML code.
- Move the cursor to the place where you want to insert the configuration file snippet.
- Enter this code:
<pre></pre>
- Move the cursor between <pre> and </pre>
- Copy the code you want to insert from the source.
- Paste it between <pre> and </pre> .
- Switch back to layout view and continue editing/saving etc.
Of course you can adopt this to your style of work:
- Instead of pasting into the HTML code, you can leave some indicator text, switch to layout view and paste the code into layout view.
- You can create a template node using this method and then copy it to other places of use.
- Instead of <pre>, you can try <code>, but I found that <pre> works better.
I'm pleased with the versatility offered by FreeMind.