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.00 00.00 config end
 2: 00.03 00.02 MarkupToHTML begin
 3: 00.03 00.02 MarkupToHTML begin
 4: 00.03 00.03 MarkupToHTML end
 5: 00.03 00.03 MarkupToHTML begin
 6: 00.04 00.03 MarkupToHTML end
 7: 00.04 00.03 MarkupToHTML begin
 8: 00.04 00.03 MarkupToHTML end
 9: 00.04 00.03 MarkupToHTML begin
10: 00.04 00.03 MarkupToHTML end
11: 00.04 00.03 MarkupToHTML begin
12: 00.04 00.04 MarkupToHTML end
13: 00.04 00.04 MarkupToHTML begin
14: 00.05 00.04 MarkupToHTML end
15: 00.05 00.04 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
16: 00.05 00.05 ReadApprovedUrls SiteAdmin.ApprovedUrls end
17: 00.06 00.05 MarkupToHTML end
18: 00.06 00.05 MarkupToHTML begin
19: 00.08 00.07 MarkupToHTML end
20: 00.08 00.07 MarkupToHTML begin
21: 00.08 00.07 MarkupToHTML end
22: 00.08 00.07 now
Peak memory: 3,125,008 bytes