Sunday 16 April 2017

Distinguishing GM Info from Player Info in Vimwiki

I write up notes for encounters in my campaign within Vimwiki.
Some notes are intended for the Player Characters.  The majority of the text is intended for the Gamemaster's eyes only.
My understanding is that the text intended for players is called Boxed Text. Here's an example of Boxed Text intended for the players:
"You awake in a room. There are two doors. A hidden voice asks, 'What door will you choose: The Lady? Or the Tiger?'"
The following note is intended for the Gamemaster only:
"Behind each door is a female tiger. Bad Gamemaster! Sneaky Gamemaster!"
I found it a challenge to keep each type of note distinct within the Vimwiki file. In the paper modules I bought as a teenager, the notes to the players were set off from the rest of the text. A light shade of grey filled the background of these text blocks, the text was indented a small amount, and a black box surrounded this text.
To recreate this effect in Vimwiki, I tried two things.
The first thing I tried was to set the text off in a Vimwiki table.
| First Announcement      |
|-------------------------|
| You enter a             |
| place filled with       |
| twisty little passages, |
| all alike.              |
This works okay as long as you are viewing the information within Vimwiki. The problems I had here began when I converted the table to HTML (and from HTML using Pandoc to any other format). Vimwiki treats this table as four separate rows. Each line of text gets its own row.
First Announcement
You enter a
place filled with
twisty little passages,
all alike.

The HTML for that looks as follows:
<table>
<tbody><tr>
<th>
First Announcement
</th>
</tr>
<tr>
<td>
You enter a
</td>
</tr>
<tr>
<td>
place filled with
</td>
</tr>
<tr>
<td>
twisty little passages,
</td>
</tr>
<tr>
<td>
all alike.
</td>
</tr>
</tbody></table>
 
That's not what I wanted.

I made an edit to Vimwiki. I forked the project on Github and added a toggle so that a table with a single column would treat all rows as one single cell.

The end result was that the HTML when converted looked like I wanted:

First Announcement
You enter a place filled with twisty little passages, all alike.

<table>
<tbody><tr>
<th>
First Announcement
</th>
</tr>
<tr><td>
You enter a
place filled with
twisty little passages,
all alike.
</td></tr>
</tbody></table>
My pull request to add this feature was not accepted by the current maintainers. So it goes.

I looked at the existing features of Vimwiki, and I realized I can achieve a similar effect by writing the text in a blockquote. The indentation sets the text off within Vimwiki. The CSS could set the text off when rendered to HTML.

This block of text in Vimwiki:

    You enter a    
    place filled with 
    twisty little passages,
    all alike. 
becomes the following
You enter a place filled with twisty little passages, all alike.
The HTML for that blockquote looks as follows:
<blockquote>
You enter a 
place filled with 
twisty little passages,
all alike. 
</blockquote>
The file vimwiki/autoload/vimwiki/style.css contains the following line:
blockquote {padding: 0.4em; background-color: #f6f5eb;}
That helps provide the background shading in the HTML.
So, in the future, GM info will be the default Vimwiki text. Text intended to be read to Player Characters, by contrast, will go between <blockquote> tags.

If you like what I've written here and want to help support future posts, please:
Thanks!