Overflow is an optional feature of links. It specifies a number of lines that exclusively belong to a link. These lines do not show up below the link. However, when a reader clicks the link, they are processed as the first lines of the new card.
That's especially useful in situations where, for instance, a switch should be set depending on the link a reader clicks. Besides switch lines, overflow works with all kinds of lines: text paragraphs, other links, stored values, check lines etc.
Define link overflow
In order to define link overflow just create an additional building block at the end of the link: Add a pipe | and a number.
When do you want to go to Francesca's?
:LINK: In the morning | at Francesca's | 1
:LINK: At night | at Francesca's | 1
:CARD: at Francesca's
"Good morning," Francesca greets you cheerfully. "Would you like an espresso with your bacon and eggs pizza?"
:CHECK: night | 2
As you're about to order you realize that all the other customers in the shop sit quietly with both hands on the table. Their heads are turned in your direction. Francesca seems worried.
"I think you should have the pizza aglio. Just to be safe," she whispers.
The first card contains two links, each with an overflow of 1. That means, the one line immediately after the link is treated as that link's overflow.
Overflowing lines are not part of the containing card. As a result, the two switches in lines 4 and 6 are not toggled when the card loads.
However, when the reader clicks on one of the links on lines 3 or 5, the switch line below flows over to the beginning of the new card. That means, when the new card loads, the overflowed switch gets toggled before anything else happens. The following lines behave accordingly.
Overflow only works as the third or fourth building block on a link. You must write your link with separate blocks for linktext and linktarget. If you already have keywords (append/sticky) as the third building block, the overflow must be the fourth.
Overflow of links in paragraphs
When you use links inside a paragraph their overflow cannot immediately follow each link. Rather, each link's overflow comes below the paragraph.
:STORE: $numOfStamps = 1
"Speaking of oddities," Francesca says, "would you like the :APPEND:blood-red | your sauce | 1:: or the new :APPEND:hopeful-green | your sauce | 2:: tomato sauce?"
:STORE: $numOfStamps + 1
:CARD: your sauce
:CHECK: red | 2
"I choose red for good company," you declare loudly.
Some people in the room start smiling. How many hours till dawn?
:CHECK: green | 2
"I choose green," you whisper.
"That's the spirit" Francesca bursts out. "For that, I'll give you an extra stamp tonight."
You receive $numOfStamps stamp(s).
There are two links inside the first paragraph, the first with an overflow of 1, the second with 2. That means, the first line after the paragraph is the overflow of the first link. The two lines after that are the overflow of the second link.
Skip lines before the overflow
There might be situations where you want to organize your lines in a way that the overflow does not immediately follow the link. For that, you can define how many lines shall be skipped before the overflow.
"Okay, pizza's ready. To go? Or would you like to sit down?"
:LINK: "I'll have my pizza here, as always." | later | 2,1
(Is that even an option?)
:LINK: "To go, please." | later
Wow, that pizza filled you up. You feel dizzy and the last thirty minutes are kind of blank in your memory. You scratch your neck. One of those darn mosquitoes must have bitten you. Ah, nevermind.
You've made it out alive.
The first link in the first card has 2,1 in its overflow block. The number before the comma stands for the lines to skip before the overflowing lines start. As a result, the paragraph in parentheses and the second link will not flow over to the next card.
The number after the comma is the number of overflowing lines. After skipping two lines below the link, the overflow is the switch line. It overflows into the next card.
Workflow tip: The source text above could have been organized in a way that skipping lines would not have been necessary. I recommend you to skip lines only in cases where anything else would not make sense.