<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/default.xsl"?>
<fr:tree xmlns:fr="http://www.forester-notes.org" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" root="false" base-url="/">
  <fr:frontmatter>
    <fr:authors />
    <fr:date>
      <fr:year>2025</fr:year>
      <fr:month>7</fr:month>
      <fr:day>14</fr:day>
    </fr:date>
    <fr:uri>https://graft.sirref.org/graft-0004/</fr:uri>
    <fr:display-uri>graft-0004</fr:display-uri>
    <fr:route>/graft-0004/</fr:route>
    <fr:title text="Forester Code Blocks">Forester Code Blocks</fr:title>
  </fr:frontmatter>
  <fr:mainmatter>
    <html:p>The markdown syntax cannot do everything that <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> can. For example, how might you <fr:link href="https://graft.sirref.org/transclude another tree into your tree/" type="external">transclude another tree into your tree</fr:link>?</html:p>
    <html:p>At any given moment, you can escape into Forester syntax by using a code block where the <html:code>infostring</html:code> is <html:code>forester</html:code>. <fr:link href="https://graft.sirref.org/graft/" type="external">Graft</fr:link> will translate this into <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> syntax and output it in the same location as the code block in the generated code.</html:p>
    <html:pre><![CDATA[```forester
\put\transclude/numbered{false}
\transclude{graft-0001}
```]]></html:pre>
  </fr:mainmatter>
  <fr:backmatter>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="References">References</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Context">Context</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>7</fr:month>
              <fr:day>14</fr:day>
            </fr:date>
            <fr:uri>https://graft.sirref.org/graft-0001/</fr:uri>
            <fr:display-uri>graft-0001</fr:display-uri>
            <fr:route>/graft-0001/</fr:route>
            <fr:title text="Markdown Syntax">Markdown Syntax</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>The markdown syntax is the core feature of <fr:link href="https://graft.sirref.org/graft/" type="external">Graft</fr:link>. It supports most of what <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> has to offer. It uses a <fr:link href="https://jekyllrb.com/docs/front-matter/" type="external">Jekyll format frontmatter</fr:link> to provide <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> metadata and supports special code blocks too.</html:p>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>14</fr:day>
                </fr:date>
                <fr:uri>https://graft.sirref.org/graft-0003/</fr:uri>
                <fr:display-uri>graft-0003</fr:display-uri>
                <fr:route>/graft-0003/</fr:route>
                <fr:title text="YAML Frontmatter">YAML Frontmatter</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>The markdown format for <fr:link href="/index/" title="Graft Documentation" uri="https://graft.sirref.org/index/" display-uri="index" type="local">Graft</fr:link> follows the Jekyll-style YAML frontmatter format. For example:</html:p>
                <html:pre><![CDATA[---
title: Hello, World!
date: 2025-07-14
---

This is a valid tree.]]></html:pre>
                <html:p>will generate a tree with <html:code>title</html:code> and <html:code>date</html:code> metadata with a single paragraph of text.</html:p>
                <html:p>To insert <html:code>meta</html:code> field into your tree, you can use a nested object in your YAML frontmatter.</html:p>
                <html:pre><![CDATA[---
title: Meta fields!
meta:
  external: http://example.org
---

External links !]]></html:pre>
                <html:p>There is no centralised documentation on these <html:code>meta</html:code><![CDATA[ fields (that I could find),]]>  but this <fr:link href="https://www.forester-notes.org/007K/index.xml" type="external">biographical tree example may be useful</fr:link></html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>15</fr:day>
                </fr:date>
                <fr:uri>https://graft.sirref.org/graft-0008/</fr:uri>
                <fr:display-uri>graft-0008</fr:display-uri>
                <fr:route>/graft-0008/</fr:route>
                <fr:title text="Subheadings are subtrees">Subheadings are subtrees</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Markdown headings are automatically transformed into "anonymous subtrees"</html:p>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>15</fr:day>
                    </fr:date>
                    <fr:title text="Anonymous!">Anonymous!</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Just like that. It means they allow authors to provide structure without adhering to the atomicity principles.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>15</fr:day>
                    </fr:date>
                    <fr:title text="Interaction with Forester Subtrees">Interaction with Forester Subtrees</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Markdown sections delimited by headings have no "closing tag". This means you that you don't quite get the nice feature of <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> where subtrees can be a standalone thing inside another text. Furthermore, including a subtree <![CDATA[will place it below the current hierarchy (as it pertains to the table of contents).]]></html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>15</fr:day>
                    </fr:date>
                    <fr:uri>https://graft.sirref.org/named-subtrees/</fr:uri>
                    <fr:display-uri>named-subtrees</fr:display-uri>
                    <fr:route>/named-subtrees/</fr:route>
                    <fr:title text="Named subtrees ">Named subtrees </fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Sometimes you don't want to create a new file just to have a referenceable tree. In this case, you want a named subtree. In the markdown syntax you can use <fr:link href="https://www.markdownguide.org/extended-syntax/#heading-ids" type="external">markdown heading IDs</fr:link> to name your subtrees. For example this section has the following heading:</html:p>
                    <html:pre><![CDATA[## Named subtrees {#named-subtrees}]]></html:pre>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>14</fr:day>
                </fr:date>
                <fr:uri>https://graft.sirref.org/graft-0004/</fr:uri>
                <fr:display-uri>graft-0004</fr:display-uri>
                <fr:route>/graft-0004/</fr:route>
                <fr:title text="Forester Code Blocks">Forester Code Blocks</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>The markdown syntax cannot do everything that <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> can. For example, how might you <fr:link href="https://graft.sirref.org/transclude another tree into your tree/" type="external">transclude another tree into your tree</fr:link>?</html:p>
                <html:p>At any given moment, you can escape into Forester syntax by using a code block where the <html:code>infostring</html:code> is <html:code>forester</html:code>. <fr:link href="https://graft.sirref.org/graft/" type="external">Graft</fr:link> will translate this into <fr:link href="https://graft.sirref.org/forester/" type="external">Forester</fr:link> syntax and output it in the same location as the code block in the generated code.</html:p>
                <html:pre><![CDATA[```forester
\put\transclude/numbered{false}
\transclude{graft-0001}
```]]></html:pre>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>14</fr:day>
                </fr:date>
                <fr:uri>https://graft.sirref.org/graft-0005/</fr:uri>
                <fr:display-uri>graft-0005</fr:display-uri>
                <fr:route>/graft-0005/</fr:route>
                <fr:title text="Other Special Code Blocks">Other Special Code Blocks</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><![CDATA[There are two other (for now) code blocks that are treated differently]]>  by <fr:link href="https://graft.sirref.org/graft/" type="external">Graft</fr:link>.</html:p>
                <html:ol>
                  <html:li>
                    <html:p><html:code>ocaml</html:code> code blocks will be run through <fr:link href="https://ocaml.org/p/hilite" type="external">hilite</fr:link> and converted to HTML.</html:p>
                  </html:li>
                </html:ol>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>16</fr:day>
                </fr:date>
                <fr:uri>https://graft.sirref.org/graft-0007/</fr:uri>
                <fr:display-uri>graft-0007</fr:display-uri>
                <fr:route>/graft-0007/</fr:route>
                <fr:title text="Verbatim HTML">Verbatim HTML</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Using markdown's HTML blocks, you can add HTML directly into your tree.</html:p>
                <html:p>For example you could embed a <html:code>marquee</html:code> element by writing.</html:p>
                <html:pre><![CDATA[<p><marquee> This is a marquee element! </marquee></p>]]></html:pre>
                <html:p>
                  <html:marquee> This is a marquee element! </html:marquee>
                </html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Backlinks">Backlinks</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Related">Related</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Contributions">Contributions</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
  </fr:backmatter>
</fr:tree>
