Anchors

Examining the behaviour of anchors used in include directives


WORKING - has newlines, some text disappears unexpectedly

start anchor at start of line, end anchor embedded in following line
%red%this is some text
[[#start]] %green%and some text within an anchored section 
%purple%next line still within anchor but doesn't appear [[#end]] %blue%and some text after it.
----
(:include {$FullName}#start#end:)

this is some text and some text within an anchored section next line still within anchor but doesn't appear and some text after it.


 and some text within an anchored section 

Non-working - start anchor is ignored

start anchor at embedded in line, end anchor embedded in following line
%red%this is some text [[#start1]] %green%and some text within an anchored section 
%purple%next line still within anchor but doesn't appear [[#end1]] %blue% and some text after it.

----
(:include {$FullName}#start1#end1:)

this is some text and some text within an anchored section next line still within anchor but doesn't appear and some text after it.


this is some text and some text within an anchored section

Non-working - start and end anchors are both ignored

start anchor and end anchor embedded in the same line
%red%this is some text [[#start2]] %green%and some text within an anchored section [[#end2]] %blue%and some text after it.

[[#end2]] (closing duplicated anchor necessary to avoid recursive includes)
----
(:include {$FullName}#start2#end2:)

this is some text and some text within an anchored section and some text after it.

 (closing duplicated anchor necessary to avoid recursive includes)

this is some text and some text within an anchored section and some text after it.

Start anchor and end anchor with following text

start anchor and end anchor on separate lines each with following text
[[#start3]] %green% start anchor followed by text
[[#end3]] %blue% end anchor followed by text
----
(:include {$FullName}#start3#end3:)

start anchor followed by text end anchor followed by text


  start anchor followed by text

Start anchor and end anchor with preceding text

start anchor and end anchor on separate lines each preceded by text
%red%start anchor preceded by text [[#start4]]
%purple%end anchor preceded by text [[#end4]]
----
(:include {$FullName}#start4#end4:)

start anchor preceded by text end anchor preceded by text


start anchor preceded by text


Explanation

This behaviour is intentional. It's that way to handle the case where anchors appear after some other start-of-line markup, such as bullet or numbered lists:

# [[#start9]]  first item
# second item
# third item
# [[#end9]]  fourth item
----
(:include {$FullName}#start9#end9:)
  1. first item
  2. second item
  3. third item
  4. fourth item

  1. first item
  2. second item
  3. third item
Peak memory: 1,457,464 bytes