Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/colbyn/subscript
MOVED TO https://github.com/subscript-publishing/subscript
https://github.com/colbyn/subscript
latex macros rust static-site-generator
Last synced: 4 months ago
JSON representation
MOVED TO https://github.com/subscript-publishing/subscript
- Host: GitHub
- URL: https://github.com/colbyn/subscript
- Owner: colbyn
- License: mpl-2.0
- Archived: true
- Created: 2019-05-01T02:33:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-17T01:33:32.000Z (about 4 years ago)
- Last Synced: 2024-09-24T06:02:11.226Z (4 months ago)
- Topics: latex, macros, rust, static-site-generator
- Language: Rust
- Homepage: https://colbyn.github.io/subscript/
- Size: 11.2 MB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MOVED TO [github.com/subscript-publishing/subscript](http://github.com/subscript-publishing/subscript)
# Subscript - Publishing using Web Technologies
> Note, originally Subscript referred to a frontend UI framework, but that has been abandoned, I’m recycling the old Subscript name for a new project. The old project can be found here [colbyn/subscript-old](https://github.com/colbyn/subscript-old).
![Preview](assets/desmos-preview.png)
## What is Subscript?
- If you are a web developer:
- Subscript is a akin web application bundlers such as Parcel, but is -better suited- for mostly static content publishing. For those who say otherwise, see my old [GitHub repository (colbyn/school-notes)](https://github.com/colbyn/school-notes), using Parcel resulted in significant friction from a multitude of problems, notably being that Parcel and PostHTML do not interact very well, especially with nested `` resources and relative file paths.
+ For example, module A and B both include module C, where module C includes asset D. PostHTML processes `` files in a top-down manner, so therefore, after inlining module C in A and B -A and B now reference module asset D, using a file path relative to module C... You can imagine Parcel would then throw errors at this... Subscript by contract mostly works in a **bottom-up** manner, where module C is processed first, then modules A and B.- If you are from academia:
- Subscript is akin to LaTeX, both are markup languages for displaying content.Furthermore both are geard towards **STEM based content** by default (unlike the [Sile typesetter](https://sile-typesetter.org)† that doen't support e.g. mathematical notation).
Yet Subscript is based on web technologies, and therefore can leverage the colossus ecosystem that makes up the web. For instance, need to display a graph of `y=x^2`? Just use a macro that embeds Desmos, and therein simply write:
```html
y=x^2
```
Or, do you need to embed musical notation? Create a macro that embeds [VexFlow](https://www.vexflow.com/).Furthermore Subscript macros are more powerful than LaTeX, because Subscript macros can access the entire html tree, which is useful for e.g. the `` macro that includes a generated table of contents at the given location.
[†]: Regarding Sile and it's innovative layout system, since Subscript is based on web technologies, it can offer responsive grid layouts for different PDF resolutions.
## High Level TODO:
- [CSS Paged Media](https://www.w3.org/TR/css-page-3/): support traditional print use cases, or just rendering to a PDF. This is what I am currently planning on using for rendering to e.g. PDFs: [PagedJS](https://www.pagedjs.org)
## Example
> FYI, you can compile the following with either
> ```bash
> cargo run -- compile --root=example --input example/pages/**/*.html --output=example/output --trim pages
> ```
> or,
> ```bash
> subscript compile --root=example --input example/pages/**/*.html --output=example/output --trim pages
> ```The following file from `./example/pages/index.html`:
```html
Hello World
First Paragraph
Second Paragraph
```
Transforms to:
```html
Note
Hello World
-
First Paragraph
-
Second Paragraph
- Third Item
```
## Math Preview
![Preview](assets/preview.png)
Comes with a syntax highlighting extension for VS Code.
![VS-Code Preview](assets/preview-vscode-plugin.png)
It injects the LaTeX grammar from [latex-workshop](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop) into the `` and `` html tags.
## Macros
> For autocomplete in VS-Code, for now, use the custom data definitions in [editors/vscode-html-macros](editors/vscode-html-macros/html-macros.json).
Versatility in Subscript is made possible VIA macros (the syntax is akin to web components, but it's expanded out at compile time compared to runtime, i.e. a macro).
For example, to display math formulas, you may use the `` macro, to plot `y = x^2`, you may use e.g. the `` macro, and etc. Furthermore, say you wanted to publish content with music notation, you could create a macro that provides a high level interface to e.g. [VexFlow](https://www.vexflow.com/).
For now, all supported macros are implemented in the core compiler.
Long term wise, I'd like to move away from the current monolithic architecture, and support extensibility in a more general manner VIA some scripting language. For this, I plan on embedding [Deno](https://github.com/denoland/deno), which will provide a multitude of benefits that e.g. NodeJS can't offer (Deno is from the creator of NodeJS).