Each link belonging to a note (basic, text or web) is started as discrete 'link' tag. Note that aliases may have their own (intrinsic) basic links, but share text/web links (web links can only be created from $Text unless differently stored as URL-type attributes). Links use a subset of possible tag attributes.
A basic link to another note (with a comment):
<link name="prototype" sourceid="3176208968" sourcecreator="John Doe" sstart="-1" slen="0" style="0" arrowtype="-1" labelx="0" labely="0" linkWidth="1" destid="3197542267" destcreator="John Doe" color="normal" destDoc="A35EDCF0-84A5-4C10-9FEC-15D289DA7B15" sourceDoc="" comment="Hello World!" />
A text link to a text target:
<link name="clarify" sourceid="3175851881" sourcecreator="John Doe" sstart="220" slen="13" dstart="0" dlen="12" style="0" arrowtype="-1" labelx="0" labely="0" linkWidth="1" destid="3175179052" destcreator="John Doe" color="normal" destDoc="A35EDCF0-84A5-4C10-9FEC-15D289DA7B15" sourceDoc="" />
A web link from $Text:
<link name="web reference" sourceid="3197539691" sourcecreator="John Doe" sstart="110" slen="7" style="0" arrowtype="-1" labelx="0" labely="0" linkWidth="1" destid="3162983401" destcreator="John Doe" color="normal" destDoc="A35EDCF0-84A5-4C10-9FEC-15D289DA7B15" sourceDoc=""URL="http://c-command.com/dropdmg/" target="new" />
Below are attributes in normal order of occurrence. Many of the element attributes listed here can be accessed via the eachLink() operator. A † indicates those items inaccessible to action code:
name. The linkType name.
sourceid. $ID of the source item.
sourcecreator †. $Creator for the source object.
sstart †. The zero-based character position of the start of the text anchor in the plain text $Text record, i.e. value of 0 implies the link anchor starts from before character #1 in the $Text. A value of -1 implies this link has no anchor, such as with basic links.
slen †. The length (number of characters) in the link anchor counting from the start sstart offset within the source $Text. It is always 0 for basic links.
dstart †. [Optional but included if empty]. Only used if there is a target anchor. The zero-based character position of the start of the destination note's text anchor in the plain text $Text record, i.e. value of 0 implies the link anchor starts from before character #1 in the $Text.
dlen †. [Optional but included if empty]. Only used if there is a target anchor. The length (number of characters) in the link anchor counting from the start dStart offset within the destination $Text.
style † (but accessible as per style booleans). This is a binary value representing the various options for line style (dot, dash, broad, etc.). By observation, always 0, zero. Values are additive for options ticked: bold = 128, linear = 64, dashed = 16, dotted = 8, broad = 256 . Thus dashed+broad = 272.
arrowtype. Type of arrowhead. Default is -1 and is the default arrow style. Circle is 1 and Arrow, if manually set, is 0.
labelx † and labely †. Default is 0, zero. If the link label is dragged from its auto-placed position. This records the X/Y offsets although the derivation of the values is undocumented. Although not always altered these attributes are always included in a link.
[cpx † and cpy † (only saved if non-default). Default is zero. They record the X/Y offsets of the link's bezier curve control (the map '-' control) if moved from their default position. As most links tend to use the automatic layout used by the app, not storing a default that is rarely changed avoids unnecessary data storage.]
sourcepad and destpad. Only included when either/both source or destination ends of the link are dragged from their auto-positioned default. Top = 2, right = 4, bottom = 6, left = 8.
linkWidth †. Always present. Value is always 1. Purpose is unknown, possibly a legacy compatibility setting for what is now the 'broad' style.
destid. $ID of the destination object
destcreator †. $Creator for the destination object.
color †. The colour of the link. Inherited from the link type. Default value is normal.
destDoc †. The destination TBX of the link. For in-document links this ID the same as the host document's UUID in the tag. If the link is an inter-document link this holds the UUID of destination document (the link' destID will also be a note ID in the target document).
sourceDoc †. Purpose not yet clear (currently unused?).
URL. [Only stored for web links and if populated]. The target URL, and the HTML href tag attribute value to use on export.
class. [Only stored for web links and if populated]. The HTML class tag attribute value to use on export.
target. [Only stored for web links and if populated]. The HTML target tag attribute value to use on export.
title. [Only stored for web links and if populated]. The HTML title tag attribute value to use on export.
comment. [Only stored if populated]. Per link, ad hoc, comment.
See also—notes linking to here: