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 config start
 1: 00.01 00.01 config end
 2: 00.22 00.21 MarkupToHTML begin
 3: 00.22 00.21 MarkupToHTML begin
 4: 00.22 00.22 MarkupToHTML end
 5: 00.22 00.22 MarkupToHTML begin
 6: 00.23 00.22 MarkupToHTML end
 7: 00.23 00.22 MarkupToHTML begin
 8: 00.23 00.22 MarkupToHTML end
 9: 00.23 00.22 MarkupToHTML begin
10: 00.23 00.22 MarkupToHTML end
11: 00.23 00.22 MarkupToHTML begin
12: 00.23 00.22 MarkupToHTML end
13: 00.23 00.22 MarkupToHTML begin
14: 00.23 00.23 MarkupToHTML end
15: 00.24 00.23 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
16: 00.24 00.23 ReadApprovedUrls SiteAdmin.ApprovedUrls end
17: 00.25 00.24 MarkupToHTML end
18: 00.25 00.24 MarkupToHTML begin
19: 00.27 00.25 MarkupToHTML end
20: 00.27 00.25 MarkupToHTML begin
21: 00.27 00.26 MarkupToHTML end
22: 00.27 00.26 now
Peak memory: 3,703,144 bytes