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
 0: 00.00 00.00 EnablePost = 1, keys=
 1: 00.00 00.00 config start
 2: 00.01 00.01 config end
 3: 00.03 00.03 MarkupToHTML begin
 4: 00.03 00.03 MarkupToHTML begin
 5: 00.04 00.04 MarkupToHTML end
 6: 00.04 00.04 MarkupToHTML begin
 7: 00.04 00.04 MarkupToHTML end
 8: 00.04 00.04 MarkupToHTML begin
 9: 00.04 00.04 MarkupToHTML end
10: 00.04 00.04 MarkupToHTML begin
11: 00.05 00.04 MarkupToHTML end
12: 00.05 00.04 MarkupToHTML begin
13: 00.05 00.04 MarkupToHTML end
14: 00.05 00.04 MarkupToHTML begin
15: 00.05 00.05 MarkupToHTML end
16: 00.05 00.05 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
17: 00.06 00.05 ReadApprovedUrls SiteAdmin.ApprovedUrls end
18: 00.06 00.06 MarkupToHTML end
19: 00.07 00.06 MarkupToHTML begin
20: 00.08 00.07 MarkupToHTML end
21: 00.08 00.07 MarkupToHTML begin
22: 00.08 00.08 MarkupToHTML end
23: 00.08 00.08 now
Peak memory: 3,906,472 bytes