diff --git a/README.md b/README.md index 4ffc9a3..ff5f2d7 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ you need to install the `dot` program from [Graphviz](https://graphviz.org/). ## Lua kernels -To execute Lua kernels you need to install `liblua` version 5.4. -Support for a statically linked Lua may be added in the future. +NML statically compiles liblua5.4 to use the lua features. # Compiling @@ -38,11 +37,11 @@ cargo build --release --bin nml - [x] References - [x] Navigation - [x] Cross-Document references + - [x] LSP - [ ] Complete Lua api - [ ] Documentation - [ ] Table - [ ] LaTeX output - - [ ] LSP # License diff --git a/readme/Basic Layouts.html b/readme/Basic Layouts.html new file mode 100644 index 0000000..60904d9 --- /dev/null +++ b/readme/Basic Layouts.html @@ -0,0 +1 @@ +NML | Basic Layouts

1. Layouts ๐Ÿ”—

You can create layout blocks by using the following tokens:

Here's an example of what you can do using layouts (with flashy colors for show):

First

Second

Third

Fourth

Fifth

Given by the following code:

1
#+LAYOUT_BEGIN[style=background-color:#F00;flex:0.5] Split
2
First
3
	#+LAYOUT_BEGIN[style=background-color:#FF0] Centered
4
		Second
5
	#+LAYOUT_END
6
#+LAYOUT_NEXT[style=background-color:#00F]
7
	Third
8
	#+LAYOUT_BEGIN[style=background-color:#0FF] Split
9
		Fourth
10
	#+LAYOUT_NEXT[style=background-color:#0F0]
11
		Fifth
12
	#+LAYOUT_END
13
#+LAYOUT_END

(indentation is for readability)

2. Available layouts ๐Ÿ”—

2.1. Centered ๐Ÿ”—

Centered layout align text to the center of the current block.

Style ๐Ÿ”—

The Centered layout uses the .centered css class to center the text.

Properties ๐Ÿ”—

2.2. Split ๐Ÿ”—

Style ๐Ÿ”—

The Split layout uses the .split-container and .split css class to create the desired layout. If you wish to modify the relative width of the splits: add style=flex: 0.5 in the properties, this makes the following split half the width of the other splits.

Properties ๐Ÿ”—

2.3. Spoiler ๐Ÿ”—

The spoiler layout creates a collapsed element which can be opened.

Spoiler demo

This content is hidden.

Style ๐Ÿ”—

The Spoiler layout uses the .spoiler class, combined with <details>/<summary> to create the desired layout.

Properties ๐Ÿ”—

\ No newline at end of file diff --git a/readme/Basic Styles.html b/readme/Basic Styles.html new file mode 100644 index 0000000..ce77cca --- /dev/null +++ b/readme/Basic Styles.html @@ -0,0 +1 @@ +NML | Basic Styles

1. Basic styles ๐Ÿ”—

1.1. Bold ๐Ÿ”—

Enclose text between two ** to render it bold!

1.2. Italic ๐Ÿ”—

Enclose text between two * to render it italic!

1.3. Underline ๐Ÿ”—

Enclose text between two __ to render it underlined!

1.4. Highlighted ๐Ÿ”—

Enclose text between two ` to render it overlined!

\ No newline at end of file diff --git a/readme/Blockquotes.html b/readme/Blockquotes.html new file mode 100644 index 0000000..206a52e --- /dev/null +++ b/readme/Blockquotes.html @@ -0,0 +1 @@ +NML | Blockquotes

1. Blockquotes ๐Ÿ”—

IMO, you shouldn't see the assignment of a CVE as a negative thing. The bug exists whether or not a CVE is assigned. The assignment of a CVE allows for people to consider what this issue means for them.

Well, that makes no sense. You don't assign CVEs to every single random bugfix we do, do you? So why this one? I understand your currency is CVEs, but this just makes CVEs useless. And hardly anymore useful than a git history... I mean, I am fine with security bureaucracy if it actually helps anyone, but you just create noise where there shouldn't be any. And that way you just piss off the upstreams whose cooperation you actually should be interested in. Your at least made sure that my own interest in helping your efforts goes to zero...

Lennart Poettering, SystemD github issue 5998

2. Nesting blockquotes ๐Ÿ”—

Quotes can be nested

Here's a subquote

Here's another subquote

With author, With cite

Back to the subquote

Another subquote

This issue is getting a bit too heated, locking right now

Given by the following
1
> Quotes can be nested
2
>> Here's a subquote
3
>>>[author=With author, cite=With cite]
4
>>> Here's another subquote
5
>> Back to the subquote
6
>
7
>> Another subquote
8
> This issue is getting a bit too heated, locking right now

3. Properties ๐Ÿ”—

Properties must be specified on the first > of the quote, inside brackets.

4. Blockquotes styling ๐Ÿ”—

The blockquotes styling controls how the author, cite and url are rendered. This is controlled by style key style.blockquote.

Default Style
1
{
2
	"author_pos": "After",
3
	"format": ["{author}, {cite}", "{author}", "{cite}"],
4
}

\ No newline at end of file diff --git a/readme/Code.html b/readme/Code.html new file mode 100644 index 0000000..38884a5 --- /dev/null +++ b/readme/Code.html @@ -0,0 +1 @@ +NML | Code

1. Full blocks of code ๐Ÿ”—

NML supports different kind of code blocks. The full block modes creates a (optionally titled), numbered code block. You can also specify the language of the block to get proper highlighting via the syntect crate.

Example:

The following...

```C, Factorial in C
int factorial(int n)
{
	if (n <= 1)
		return 1;
	return n * factorial(n - 1);
}
```

...gives the following

Factorial in C
1
int factorial(int n)
2
{
3
	if (n <= 1)
4
		return 1;
5
	return n * factorial(n - 1);
6
}

Properties ๐Ÿ”—

2. Mini blocks ๐Ÿ”—

Mini blocks are code blocks that can span on a single line (thus blending within a paragraph).

Example:

Mini blocks can span multiple lines, in which case they become similar to full code blocks with the following differences:

  1. No title: Mini blocks cannot have a title at all
  2. No line numbers: Line numbers won't be shown

Example:

The following...

``Rust
fn real_position(
	source: Rc<dyn Source>,
	position: usize
) -> (Rc<dyn Source>, usize)
{
	if let Some(parent) = source.parent
	{
		return real_position(parent.clone(), source.apply_offsets(position));
	}
	return (source.clone(), source.apply_offsets(position));
}
``

...gives the following

fn real_position(
	source: Rc<dyn Source>,
	position: usize
) -> (Rc<dyn Source>, usize)
{
	if let Some(parent) = source.parent
	{
		return real_position(parent.clone(), source.apply_offsets(position));
	}
	return (source.clone(), source.apply_offsets(position));
}

3. Code theme ๐Ÿ”—

Code theme can be controlled by the variable code.theme. The default value is base16-ocean.dark. According to syntect's documentation, the following themes are available:

\ No newline at end of file diff --git a/readme/Comments.html b/readme/Comments.html new file mode 100644 index 0000000..2686852 --- /dev/null +++ b/readme/Comments.html @@ -0,0 +1 @@ +NML | Comments
Table of Content
  1. Comments

1. Comments ๐Ÿ”—

NML supports line comment with the following syntax: :: Comment

Comments will eat any preceding white space.

Example

\ No newline at end of file diff --git a/readme/Getting Started.html b/readme/Getting Started.html new file mode 100644 index 0000000..8d0bfc2 --- /dev/null +++ b/readme/Getting Started.html @@ -0,0 +1 @@ +NML | Getting Started

1. Building NML ๐Ÿ”—

You need at least the nightly version of rustc to compile NML. Instruction for your operating system can be found on Rust's website. You'll also need liblua 5.4 installed. You can then move the nml executable in target/release/nml into your $PATH

cargo build --bin nml or for release mode: cargo build --release --bin nml(Note: The release build binary is much smaller than the debug build one)

2. Building your first document ๐Ÿ”—

3. Using the cache ๐Ÿ”—

NML relies on sqlite to keep a cache of pre-compiled elements that take a long time to process (e.g ). To enable caching, use option -d with a path: -d cache.db. You can reuse the same cache for multiple documents and benefit from cached elements. Note that in directory-processing mode, a cache is required so that only modified .nml files get reprocessed.

Elements that will use the cache:

4. Directory-Processing mode ๐Ÿ”—

To use directory-processing mode, you need to pass an input directory and an output directory. Directory-processing mode requires that you use a database, so that it knows which documents have already been compiled. If the output directory doesn't exist, it will be automatically created.

Compiling the docs: nml -i docs -o docs_out -d cache.db

If you modify an @imported file, you will need to use the --force-rebuild option, as NML currently doesn't track which files are imported by other files.

5. Building the Language Server ๐Ÿ”—

NML comes with it's own language server, ready to be used in any LSP-compatible text editor, such as NeoVim.

Build it by using the following command: cargo build --bin nmlls or for release mode: cargo build --release --bin nmlls(Note: The release build binary is much smaller than the debug build one)

You should move the language server somewhere in your $PATH.

Integrating the LSP ๐Ÿ”—

Below is a list of integration steps the language server in various editors.

NeoVim ๐Ÿ”—

The first step is to add the .nml extension to NeoVim, so it is recognized:

vim.filetype.add({
	pattern = {
		['.*%.nml'] = 'nml',
	},
})

Then you need to register the language server in NeoVim. I recommend the lsp-zero plugin for that purpose:

{
	"VonHeikemen/lsp-zero.nvim",
	config = function()
		local lsp_zero = require('lsp-zero')

		lsp_zero.on_attach(function(client, bufnr)
			lsp_zero.default_keymaps({buffer = bufnr})
		end)

		lsp_zero.new_client({
			name = 'nmlls',
			cmd = {'<PATH TO BINARY IF NOT IN $PATH/>nmlls'},
			filetypes = {'nml'},
		})
	end,
}

\ No newline at end of file diff --git a/readme/Graphviz.html b/readme/Graphviz.html new file mode 100644 index 0000000..c9397e7 --- /dev/null +++ b/readme/Graphviz.html @@ -0,0 +1,333 @@ +NML | Graphviz

1. Graphs from graphviz ๐Ÿ”—

+ +%3 + +cluster_0 + +Processing + + +cluster_1 + +Post-Processing + + + +filelist + +File List + + + +iscached + +Cached? + + + +filelist->iscached + + + + + +doclist + +Document List + + + +buildnav + +Build Navigation + + + +doclist->buildnav + + +Cached + + + +xref + +Resolve Cross-References + + + +doclist->xref + + + + + +iscached->doclist + + +Yes + + + +parse + +Parse + + + +iscached->parse + + +No + + + +cache + +Cache + + + +iscached->cache + + + + + + +compile + +Compile + + + +parse->compile + + + + + +compile->doclist + + + + + +output + +Output + + + +buildnav->output + + + + + +xref->cache + + + + + +xref->buildnav + + + + + +

The Graphviz functionnality requires the dot executable. More information on Graphviz's website.

2. Synopsis ๐Ÿ”—

Graphs blocks are delimited by [graph]...[/graph]

3. Properties ๐Ÿ”—

4. Examples ๐Ÿ”—

+ +UML_Class_diagram +UML Class diagram demo + + +Client + +Client + + + +Interface1 + +ยซinterfaceยป I/O + ++ property +... + ++ method +... + + + +Client->Interface1 + + +dependency + + + +Interface2 + +Simple +interface + + + +Client->Interface2 + + + + + +Class1 + +I/O class + ++ property +... + ++ method +... + + + +Interface1->Class1 + + +inheritance + + + +Interface2->Class1 + + + + +System_1 + + + +System + + ++ property +- Subsystem 1 +- Subsystem 2 +- Subsystem 3 +... + ++ method +... + + + +Class1->System_1 + + +implementation + + + +Subsystem_1 + + + +Subsystem 1 + + ++ property +- resource +... + ++ method +... + + + +System_1:ss1->Subsystem_1 + + +composition + + + +Subsystem_2 + + + +Subsystem 2 + + ++ property +- resource +... + ++ method +... + + + +System_1:ss2->Subsystem_2 + + + + + +Subsystem_3 + + + +Subsystem 3 + + ++ property +- resource +... + ++ method +... + + + +System_1:ss3->Subsystem_3 + + + + + +Shared resource + +Shared resource + ++ property +... + ++ method +... + + + +Subsystem_1:r1->Shared resource + + +aggregation + + + +Subsystem_2:r1->Shared resource + + + + + +Subsystem_3:r1->Shared resource + + + + + +

Generated by the following code:

[graph]
digraph UML_Class_diagram {
	bgcolor=transparent;
	graph[fontcolor=darkgray];
	node[fontcolor=darkgray];
	edge[fontcolor=darkgray, color=gray90];
	graph [
		label="UML Class diagram demo"
		labelloc="t"
		fontname="Helvetica,Arial,sans-serif"
	]
	node [
		fontname="Helvetica,Arial,sans-serif"
		shape=record
		style=filled
		fillcolor=gray95
	]
	edge [fontname="Helvetica,Arial,sans-serif"]
	edge [arrowhead=vee style=dashed]
	Client -> Interface1 [label=dependency]
	Client -> Interface2

	edge [dir=back arrowtail=empty style=""]
	Interface1 -> Class1 [xlabel=inheritance]
	Interface2 -> Class1 [dir=none]
	Interface2 [label="" xlabel="Simple\ninterface" shape=circle]

	Interface1[label = <{<b>ยซinterfaceยป I/O</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
	Class1[label = <{<b>I/O class</b> | + property<br align="left"/>...<br align="left"/>|+ method<br align="left"/>...<br align="left"/>}>]
	edge [dir=back arrowtail=empty style=dashed]
	Class1 -> System_1 [label=implementation]
	System_1 [
		shape=plain
		label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
			<tr> <td> <b>System</b> </td> </tr>
			<tr> <td>
				<table border="0" cellborder="0" cellspacing="0" >
					<tr> <td align="left" >+ property</td> </tr>
					<tr> <td port="ss1" align="left" >- Subsystem 1</td> </tr>
					<tr> <td port="ss2" align="left" >- Subsystem 2</td> </tr>
					<tr> <td port="ss3" align="left" >- Subsystem 3</td> </tr>
					<tr> <td align="left">...</td> </tr>
				</table>
			</td> </tr>
			<tr> <td align="left">+ method<br/>...<br align="left"/></td> </tr>
		</table>>
	]

	edge [dir=back arrowtail=diamond]
	System_1:ss1 -> Subsystem_1 [xlabel="composition"]

	Subsystem_1 [
		shape=plain
		label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
			<tr> <td> <b>Subsystem 1</b> </td> </tr>
			<tr> <td>
				<table border="0" cellborder="0" cellspacing="0" >
					<tr> <td align="left">+ property</td> </tr>
					<tr> <td align="left" port="r1">- resource</td> </tr>
					<tr> <td align="left">...</td> </tr>
				</table>
				</td> </tr>
			<tr> <td align="left">
				+ method<br/>
				...<br align="left"/>
			</td> </tr>
		</table>>
	]
	Subsystem_2 [
		shape=plain
		label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
			<tr> <td> <b>Subsystem 2</b> </td> </tr>
			<tr> <td>
				<table align="left" border="0" cellborder="0" cellspacing="0" >
					<tr> <td align="left">+ property</td> </tr>
					<tr> <td align="left" port="r1">- resource</td> </tr>
					<tr> <td align="left">...</td> </tr>
				</table>
				</td> </tr>
			<tr> <td align="left">
				+ method<br/>
				...<br align="left"/>
			</td> </tr>
		</table>>
	]
	Subsystem_3 [
		shape=plain
		label=<<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
			<tr> <td> <b>Subsystem 3</b> </td> </tr>
			<tr> <td>
				<table border="0" cellborder="0" cellspacing="0" >
					<tr> <td align="left">+ property</td> </tr>
					<tr> <td align="left" port="r1">- resource</td> </tr>
					<tr> <td align="left">...</td> </tr>
				</table>
				</td> </tr>
			<tr> <td align="left">
				+ method<br/>
				...<br align="left"/>
			</td> </tr>
		</table>>
	]
	System_1:ss2 -> Subsystem_2;
	System_1:ss3 -> Subsystem_3;

	edge [xdir=back arrowtail=odiamond]
	Subsystem_1:r1 -> "Shared resource" [label=aggregation]
	Subsystem_2:r1 -> "Shared resource"
	Subsystem_3:r1 -> "Shared resource"
	"Shared resource" [
		label = <{
			<b>Shared resource</b>
			|
				+ property<br align="left"/>
				...<br align="left"/>
			|
				+ method<br align="left"/>
				...<br align="left"/>
			}>
	]
}
[/graph]

5. Graphiz cache ๐Ÿ”—

Graphviz graphs that have been rendered to svg are stored in the cache database, under table cached_dot. Unless you modify the graph or it's properties, it won't be rendered again, instead it will be sourced from the database.

6. Bindigs ๐Ÿ”—

\ No newline at end of file diff --git a/readme/Imports.html b/readme/Imports.html new file mode 100644 index 0000000..913a1fd --- /dev/null +++ b/readme/Imports.html @@ -0,0 +1 @@ +NML | Imports
Table of Content
  1. Imports
  2. Scoped imports

1. Imports ๐Ÿ”—

NML lets you import documents into the current document via the following syntax:

@import <PATH.nml> Note that this will import everything from the other document, such as content but also variables and references.

2. Scoped imports ๐Ÿ”—

If you wish to import a document, while not overwriting current variables and references, use the following:

@import[as=util] lib.nml With this syntax, any variable or reference imported will be prefixed with util.

\ No newline at end of file diff --git a/readme/LaTeX.html b/readme/LaTeX.html new file mode 100644 index 0000000..23dd159 --- /dev/null +++ b/readme/LaTeX.html @@ -0,0 +1 @@ +NML | LaTeX

Bring some LaTeX unto your document!

1. Requirements ๐Ÿ”—

In order to use LaTeX processing, you need to have a LaTeX distribution installed. We recommend the TeX Live distribution. You'll also need to install the latex2svg python script provided with NML. You'll have to follow the installation instructions from the original latex2svg repository. If you don't want to add the script to your $PATH, you can set the executable path in the ยง{tex_env}[caption=LaTeX environment].

2. Inline Math ๐Ÿ”—

You can add inline math by enclosing LaTeX between two $:

You can make the LaTeX non inline by specifying kind=block in it's property: $[kind=block] 1+1=2$ โ†’

(notice how it's not inside a paragraph)

3. Non Math LaTeX ๐Ÿ”—

You can write LaTeX outside of LaTeX's math environment, by enclosing your code between $|...|$:


$|\begin{tikzpicture}
	\begin{axis}
	\addplot3[patch,patch refines=3,
		shader=faceted interp,
		patch type=biquadratic] 
	table[z expr=x^2-y^2]
	{
		x  y
		-2 -2
		2  -2
		2  2
		-2 2
		0  -2
		2  0
		0  2
		-2 0
		0  0
	};
	\end{axis}
\end{tikzpicture}|$

Gives the following:

4. LaTeX environment ๐Ÿ”—

You can define multiple LaTeX environment, the default being main

Replace env with the name of the custom environment you wish to define.

Here's a preamble to render LaTeX gray:

@tex.main.fontsize = 9
@tex.main.preamble = \usepackage{xcolor} \\
\usepgfplotslibrary{patchplots} \\
\definecolor{__color1}{HTML}{d5d5d5} \\
\everymath{\color{__color1}}
@tex.main.block_prepend = \color{__color1}

To set the environment you wish to use for a particular LaTeX element, set the env property:

5. Properties ๐Ÿ”—

6. LaTeX cache ๐Ÿ”—

LaTeX elements that have been successfully rendered to svg are stored in the cache database, to avoid processing them a second time. Note that this cache is shared between documents, so you don't need to reprocess them if they share the same environment. They are stored under the table named cached_tex, if you modify the env all elements will be reprocessed which may take a while...

7. Bindings ๐Ÿ”—

\ No newline at end of file diff --git a/readme/Lists.html b/readme/Lists.html new file mode 100644 index 0000000..28be796 --- /dev/null +++ b/readme/Lists.html @@ -0,0 +1 @@ +NML | Lists

1. Lists ๐Ÿ”—

Lists start after a newline with one or more space or tab, followed by * for unnumbered lists or - for numbered lists.

Example

The following...

1
 * A
2
 * B
3

4
 - A
5
 - B

...gives the following

  • A
  • B
  1. A
  2. B

2. Nested lists ๐Ÿ”—

Lists can contain other lists as nested elements.

Example

The following...

1
 - First
2
 --[offset=11] Nested
3
 -- Numbered list!
4
 - Back to the first list

...gives the following

  1. First
    1. Nested
    2. Numbered list!
  2. Back to the first list

3. Properties ๐Ÿ”—

Lists currently support these properties:

\ No newline at end of file diff --git a/readme/Lua Basics.html b/readme/Lua Basics.html new file mode 100644 index 0000000..56af0b7 --- /dev/null +++ b/readme/Lua Basics.html @@ -0,0 +1 @@ +NML | Lua Basics

1. Running lua code ๐Ÿ”—

Running lua code is done using the following syntax: %<print("Hello World!")>%

1.1. Lua to text ๐Ÿ”—

To convert the return value of your lua code, append " at the start of your lua expression:

1.2. Parse lua string ๐Ÿ”—

Additionnaly, you can output lua to be parsed by the document's parser. To do so, append ! at the start of your lua expression:

\ No newline at end of file diff --git a/readme/Raw.html b/readme/Raw.html new file mode 100644 index 0000000..f993b58 --- /dev/null +++ b/readme/Raw.html @@ -0,0 +1 @@ +NML | Raw

Raws are elements to be rendered as-is by the compiler.

1. Inline raws ๐Ÿ”—

Inline raws are meant to be used inside a paragraph and thus, don't break the paragraph. Here's the syntax for inline raws: {?[kind=inline] CONTENT ?}. Here, CONTENT will added directly to the resulting document.

Example

Raws are better paired with Lua, see Defining a custom style for how to use them.

2. Block raws ๐Ÿ”—

You can have raw elements take a full block to define additional capabilities. The syntax is similar to inline raws, except that kind=block is used instead.

Example

3. Properties ๐Ÿ”—

\ No newline at end of file diff --git a/readme/References.html b/readme/References.html new file mode 100644 index 0000000..deb374a --- /dev/null +++ b/readme/References.html @@ -0,0 +1 @@ +NML | References

1. Internal references ๐Ÿ”—

Internal references allow you to create references to elements defined within the current document.

Reference the the current section: &{internal_reference} โ†’ (Internal references)

1.1. Media references ๐Ÿ”—

(1) Flower

When you reference a medium from the current document, the reference can be hovered to show the referenced medium: (1).

1. External references ๐Ÿ”—

You can reference elements from other documents by adding the document's name before the reference name (separated by a #). The document name refers to the output file (as defined by the variable compiler.output) excluding the extension.

For instance:

2. Properties ๐Ÿ”—

\ No newline at end of file diff --git a/readme/Sections.html b/readme/Sections.html new file mode 100644 index 0000000..291f18f --- /dev/null +++ b/readme/Sections.html @@ -0,0 +1 @@ +NML | Sections

1. Sections ๐Ÿ”—

To add a section to your document, put one or more # at the start of the line, followed a space and the name of your section.

Which will render as:

2. Section name ๐Ÿ”—

2.1. Subsection ๐Ÿ”—

Unnumbered section ๐Ÿ”—

2.2. Unnumbered section ๐Ÿ”—

2. This section is not in the ToC ๐Ÿ”—

Given by the following:

# Section name
## Subsection
#* Unnumbered section
#+ This section is not in the ToC

3. Sections references ๐Ÿ”—

You can create a referenceable section by using #{refname}, where refname is an internal reference name for use only within this document. You can then create a clickable reference to this section: ยง{refname} or ยง{refname}[caption=Click me!]. Below is an example of this in action:

Section ๐Ÿ”—

ยง{refname}[caption=Click me!] or ยง{first}[caption=First section]

###{refname}+* Section
ยง{refname}[caption=Click me!] or ยง{first}[caption=First section]

4. Table of Content ๐Ÿ”—

Section can be automatically exported to a table of content, such as shown at the top of this document. To create a table of content, simply add #+TABLE_OF_CONTENT somewhere in your document and it will be displayed there.

5. Section styling ๐Ÿ”—

The styling for the section link is controlled by the style key style.section

Default Style
1
{
2
	"link_pos": "Before",
3
	"link": ["", "๐Ÿ”—", " "]
4
}

6. Bindings ๐Ÿ”—

\ No newline at end of file diff --git a/readme/User-Defined Styles.html b/readme/User-Defined Styles.html new file mode 100644 index 0000000..26a5196 --- /dev/null +++ b/readme/User-Defined Styles.html @@ -0,0 +1 @@ +NML | User-Defined Styles

1. Defining a custom style ๐Ÿ”—

1
function undercustom_start(color)
2
	nml.raw.push("inline", "<span style=\"border-bottom: 1px dashed " .. color .. "\">")
3
end
4

5
function undercustom_end()
6
	nml.raw.push("inline", "</span>")
7
end
8

9
nml.custom_style.define_toggled("Undercustom Red", "~", function() undercustom_start("red") end, undercustom_end)
10
nml.custom_style.define_paired("Undercustom Green", "[|", "|]", function() undercustom_start("green") end, undercustom_end)
11
>%

Results in the following:

2. Limitations ๐Ÿ”—

\ No newline at end of file diff --git a/readme/Variables.html b/readme/Variables.html new file mode 100644 index 0000000..9177927 --- /dev/null +++ b/readme/Variables.html @@ -0,0 +1 @@ +NML | Variables

1. Variable definition ๐Ÿ”—

In NML you can defines variables and call them later.

Currently, two types of variables are supported:

To define a variable use the following syntax:

@var = value
:: Text variable
@'my_file = ./pic.png
:: Path variable

Variable names cannot contain % or =. However variables values can span across multiple lines:

@var = A\
B
:: var == "AB"
@var = A\\
B
:: var == "A\nB"

Using a single \'s will ignore the following newline, using two \\'s will keep the newline.

2. Variable substitution ๐Ÿ”—

Once variables have been defined, you can call them to be expanded to their content:

@var = Hello, World!
:: Definition
%var%
:: Substitution

Expanded variables will be processed by the parser to display their content, as if you had written the variable's value directly.

\ No newline at end of file diff --git a/readme/assets/duck.jpg b/readme/assets/duck.jpg new file mode 100644 index 0000000..5c08fcc Binary files /dev/null and b/readme/assets/duck.jpg differ diff --git a/readme/assets/flower.png b/readme/assets/flower.png new file mode 100644 index 0000000..f044d19 Binary files /dev/null and b/readme/assets/flower.png differ diff --git a/readme/assets/flower.webm b/readme/assets/flower.webm new file mode 100644 index 0000000..5b8edf7 Binary files /dev/null and b/readme/assets/flower.webm differ