Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michaelhatherly/mdinclude.jl
Include markdown files as Julia source code.
https://github.com/michaelhatherly/mdinclude.jl
Last synced: about 2 months ago
JSON representation
Include markdown files as Julia source code.
- Host: GitHub
- URL: https://github.com/michaelhatherly/mdinclude.jl
- Owner: MichaelHatherly
- License: mit
- Created: 2020-09-10T21:30:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-02T09:16:22.000Z (10 months ago)
- Last Synced: 2024-11-02T15:15:08.871Z (3 months ago)
- Language: Julia
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MDInclude
`include` your markdown files as if they were Julia source files. This package
was inspired by the similar package for Jupyter notebooks called
[NBInclude.jl](https://github.com/stevengj/NBInclude.jl).## Installation
```
pkg> add https://github.com/MichaelHatherly/MDInclude.jl
```## Usage
Why not turn your README into the package source! What could go wrong...
```julia
module MyPackageusing MDInclude
@mdinclude("../README.md")
end
```More seriously though, you can use the macro `@mdinclude` as you would
`include` from `Base` or `@nbinclude` from NBInclude.jl to write your package,
or just for writing a once-off script.Additionally, a `mdinclude` function is provided so that you can set the
`Module` into which you want to evaluate the code in your markdown file.```julia
mdinclude(MyModule, "file.md")
```## Custom Evaluation
The parsing and evaluation of markdown files can be customised by providing a
"configuration" object as the final argument to either `@mdinclude` or
`mdinclude`. This can be used to change what is done during each step of
parsing and evaluating the file. The following functions provide access points
within the parsing and evaluation steps for customisation:- `markdown(config, path)`
- `isvalid(config, node)`
- `source(config, node)`
- `expression(config, ex)`
- `setmodule(config, node, default)`
- `capture(f, config)`Read the docstrings for details regarding their use.