NeX is a markup language with lightweight syntax designed for note-taking and drafting documents, especially for fields of study related to mathematics and computer science.
NOTE: This project is in early development stages. Use with caution.
NeX is designed to be an alternative to LaTeX for a wide variety of similar use cases. NeX greatly reduces the complexity in typing math equations (see NeX Math), facilitates the inclusion of a variety of different formatting elements without the need for external packages, and provides ways to create more complex visual elements such as diagrams and graphs using similarly intuitive syntax.
To see examples of NeX syntax, see the examples/
folder.
- Based off Markdown: NeX aims to largely exist as a superset of Markdown, a common markup syntax. Many syntax rules such as using
astrisks (
*
) for italics, using pound prefixes (##
) for headers, and so on, should feel familiar (partially implemented). - Custom math syntax: NeX uses a custom LaTeX-based syntax for writing math that is designed to feel more intuitive, faster to write, and easier to read, yet still retain the same flexibility as LaTeX.
- Desmos integration: NeX makes use of the Desmos API to allow you to embed Desmos graphs directly into your documents.
- Theme support: NeX includes several themes to customize the look of your documents. You can also easily create your own themes using plain CSS.
- Dependency bundling: NeX generates standalone HTML files that have all relevant assets, dependencies, and media bundled with the HTML file itself so that it can be shared by itself and viewed on any device, even without an internet connection.
- Syntax highlighting: Include code blocks using Markdown-style syntax that are automatically highlighted according to the specified language.
- Visual Studio Code Integration: NeX has a VS Code extension to enable autocomplete, syntax highlighting, and more.
- NeX Notebooks: NeX can generate nested document structures into a single HTML file that provides built-in navigation between pages and the ability to search all pages at once.
- Live editing: NeX will display the rendered contents of a NeX document inside of a webpage that automatically hot-reloads to reflect changes without manually having to rebuild an HTML file.
- Diagrams: Create embedded diagrams in your document using intuitive syntax.
You need to have Node.js (v14 or higher) installed to run NeX.
- Download this repository, then
cd
to the downloaded copy of this repository. - Run
npm install
. - Run
tsc
. - Run
npm link
. This command may require elevated privileges. - Run
nex help
to confirm that NeX is working.
NeX is designed to mimic much of the syntax of markdown. In other words, almost all standard markdown syntax will work as expected in NeX. To start, create a NeX called hello.nex
. Type the following into the file,
Hello, world!
and run nex build hello.nex
. NeX should output an HTML file called hello.html
. If you open it, you should see a plain white page containing the words "Hello, world!".
nex build [file]
will convert a NeX file into a standalone HTML file with any external assets bundled by default into the HTML code itself as base-64 data. This HTML file can then be viewed by itself on any device with or without internet*. Keep in mind, however, that while this HTML file is standalone, it will still require Javascript to be viewed properly.
*Any URL links or URL-linked images will still require an internet connection to view properly.
NeX Math is NeX's alternative to LaTeX math syntax. NeX math focuses more on user-friendliness, readability, and conciseness rather than syntactical rigor.
Note that NeX Math is whitespace agnostic, similar to LaTeX (i.e. there is no semantic difference between x+1
, x+ 1
and x + 1
)
Here are some examples of NeX math and their corresponding LaTeX expressions:
1 + 1/x
1 + (x+1)/x
Notice that the parentheses defining where the numerator x+1
starts and ends are automatically removed. If you wanted to keep the parentheses, you would do this:
1 + ((x+1))/x
3x^2 + 2x + 1
1 + cos x
sqrt(x+1)
log_b a = (ln a)/(ln b)
A=pi r^2