Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baggepinnen/literateweave.jl
Automatic convertion from .jl file to pdf/html using Literate.jl -> Weave.jl
https://github.com/baggepinnen/literateweave.jl
code-documentation documentation-generator literate-programming publishing report-generation reporting weave
Last synced: about 1 month ago
JSON representation
Automatic convertion from .jl file to pdf/html using Literate.jl -> Weave.jl
- Host: GitHub
- URL: https://github.com/baggepinnen/literateweave.jl
- Owner: baggepinnen
- Created: 2019-05-08T07:38:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-12T05:42:15.000Z (over 3 years ago)
- Last Synced: 2024-07-30T20:05:46.855Z (4 months ago)
- Topics: code-documentation, documentation-generator, literate-programming, publishing, report-generation, reporting, weave
- Language: Julia
- Size: 13.7 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LiterateWeave.jl
This package automatically runs a julia source file and converts it to, e.g., a pdf or html while capturing output such as figures and text.
We convert a source `.jl` file to markdown using [Literate.jl](https://github.com/fredrikekre/Literate.jl) and then weaves this markdown file to, e.g., pdf or html, using [Weave.jl](https://github.com/mpastell/Weave.jl). Write your code file as if you were using Literate.jl
This package exports a single function
```julia
literateweave(source, args...; kwargs...)
```
`args` and `kwargs` goes to `weave(s, args...; kwargs...)`## Examplea
```julia
literateweave("myfile.jl", doctype="md2pdf", latex_cmd="lualatex")
literateweave("myfile.jl", weave=notebook)
page = literateweave("myfile.jl", doctype="md2html"); run(`sensible-browser $page`)
```## Notes
- Figures are captured by Weave. If you have multiple plot commands producing multiple plots, separate them by `#`, e.g.:
```julia
plot(...)
#
plot(...)
```- The Juno cell-separator `##` is treated as an inline comment by Literate and does thus not split a cell in the output.
- Inline latex math is supported using `$x+y$`## Why a package
I created this package to solve the following problem:Literate.jl allows me to write code as normal and insert normal comments, and then converting this code to markdown. Unfortunately, Literate does not run the code or capture output.
Weave.jl does run the code and capture the output, but requires you to write a `.jmd` file which is much less convenient to work with compared to a normal julia source file, which is often what you start out with.
## Credits
All credits goes to the creators of Literate.jl and Weave.jl. This package just glues them together.