https://github.com/foxfriends/outline-loader
Webpack loader to parse literate files with Outline
https://github.com/foxfriends/outline-loader
literate literate-programming
Last synced: 3 months ago
JSON representation
Webpack loader to parse literate files with Outline
- Host: GitHub
- URL: https://github.com/foxfriends/outline-loader
- Owner: foxfriends
- License: mit
- Created: 2018-12-16T06:06:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T00:06:58.000Z (over 2 years ago)
- Last Synced: 2025-01-20T19:13:26.831Z (4 months ago)
- Topics: literate, literate-programming
- Language: JavaScript
- Size: 1.74 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[Outline]: https://github.comfoxfriendsoinkiguana/outline
# Outline Loader
A Webpack loader that works with [Outline][] to compile literate JavaScript.
## Installation
```bash
npm install --save-dev @oinkiguana/outline-loader
```## Options
* `language`: Passed to Outline's `-l` parameter, indicating the language tag to compile with
* `style`: Passed to Outline's `-s` parameter to override the automatically detected style
* `config`: Passed to Outline's `-c` parameter to specify the path to the `Outline.toml` file
* `entrypoint`: Passed to Outline's `-e` parameter to choose a named entrypoint
* `output`: Can be set to `tangle` or `weave`, to indicate whether to tangle the source (output
code) or weave it (output documentation)## Example usage:
`index.js`
```js
import { myFunction } from './functions.js.tex';myFunction(3); // => 5
````functions.js.tex`
```tex
\documentclass[11pt,a4paper]{article}\begin{document}
This module works like this:
\begin{code}
==> Define some functions.
==> Export the functions.
\end{code}Our function \texttt{myFunction} is used to add two to any input.
\begin{code}[name=Define some functions]
function myFunction(input) {
return input + 2;
}
\end{code}Now that all the functions are written, they must be exported.
\begin{code}[name=Export the functions]
export { myFunction };
\end{code}\end{document}
````webpack.config.js`
```js
module.exports = {
entry: 'index.js',
module: {
rules: [
{ test: /\.js\.(tex|md|html|bird)$/, loader: 'outline-loader' },
],
},
};
```