A Data Modeling Language
Link Text is a little more than a markup language, tending toward a programming language. In fact, it can be used for a programming language. It is a way to model information and computation in an easy to read and write format, suitable for hierarchical note taking and other means of capturing data down into structured form.
It emerged out of the desire to have one way of writing things (notes, code, data models, etc.), that was not too verbose and was easy to learn with very few rules. Writing in all lowercase without having to use the shift key streamlines your typing so you can stream out your knowledge the most quickly. Existing markup languages like XML, JSON, and YAML are too static and don't let you define things in as concise a way as possible. It is indentation-based, and the typical style of a DSL is to write it in a somewhat repetitive way to give the quick visual cues as to the meaning of things. But the way you use it is entirely up to you, those are just style conventions.
First, some images of different usages of Link Text. Here are a few examples from existing code. The first is how you might define a "deck" (a "package" of Link code). The second is the first part of the Tao Te Ching captured in a tree, and the later we show how you might write a simple fibonacci function. These examples are DSLs designed for a specific purposes. As you will see in the syntax section, the Link language is independent of a DSL and simply defines some simple idioms for defining trees of text.
A package definition:
The first block of the Tao Te Ching:
And now for some pictures of the code, since we can't get GitHub to offer syntax highlighting for a while.
Now we will go into the actual specification of the syntax. The Link specification language is a minimal modeling language that is transformable into code. The file extension to be used is
The first thing to cover are terms. They are composed of words, separated by dashes. A word is composed of lowercase ascii letters or numbers. A term can't start with a number. So the following are all words of a term.
The following is an invalid term.
You can nest them arbitrarily into trees. These are all trees.
You can write multiple nodes on a line separated by comma:
The same as:
You can put things in parentheses too to make it easier to write on one line:
The same as:
You can use numbers ("marks") in the system too:
A comb is a decimal number.
A more complex structure is the text. They are composed of a weaving of cords (strings) and terms. A string/cord is a contiguous sequence of arbitrary unicode (utf-8).
A simple template composed only of a string is:
Or multiline text:
Then we can add interpolation into the template, by referencing terms wrapped in angle brackets:
A more robust example might be:
Note though, you can still use the angle bracket symbols in regular text without ambiguity, you just need to prefix them with backslashes.
You can write specific code points, or codes, by prefixing the number sign / hash symbol along with a letter representing the code type, followed by the code.
These can also be used directly in a template:
This makes it so you can reference obscure symbols by their numerical value, or write bits and things like that. Note though, these just get compiled down to the following, so the code handler would need to resolve them properly in the proper context.
A nest is a selector, which is a digging down into terms. They look like paths, but they are really diving down into terms, if you think of it that way.
You can interpolate on these as well, like doing array index lookup.
The interpolations can be nested as well, and chained. Here is a complex example:
There is also room to write
Finally, we have the
A line is a path, like a file path. Because paths are so common in programming, they don't need to be treated as strings but can be written directly. The special
That is, they are just special strings. You can interpolate on them like strings as well with curly brackets.
That is all there is to it! It is a simple way of defining trees of text, allowing for template variables inside text, and for basic primitives. It is then up to you to figure out what you want to do with it. Take a look at the
Syntax Highlighter Installation
The Link Text has a syntax highlighter For VSCode. It's not perfect yet but it gets the job done. If you are new to the Link Text language, here we will give a brief overview of the syntax. Explore some of our other repos to get a deeper understanding of the types of things you can do with Link Text. It's far from complete but a labor of love. Making a little progress all the time.
You can install the VSCode syntax highlighter from source by placing the unzipped folder into
Inside the editor, press
Here is more info on building an extension. Here is how to publish the extension.
Copyright 2021-2022 TreeSurf
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This is being developed by the folks at TreeSurf, a California-based project for helping humanity master information and computation. TreeSurf started off in the winter of 2008 as a spark of an idea, to forming a company 10 years later in the winter of 2018, to a seed of a project just beginning its development phases. It is entirely bootstrapped by working full time and running Etsy and Amazon shops. Also find us on Facebook, Twitter, and LinkedIn. Check out our other GitHub projects as well!