GithubHelp home page GithubHelp logo

entangled / mkdocs-plugin Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 147 KB

An MkDocs plugin that lets you do Literate Programming through Entangled.

Home Page: https://entangled.github.io/mkdocs-plugin/

License: Apache License 2.0

Python 100.00%
literate-programming markdown mkdocs-plugin

mkdocs-plugin's Introduction

Welcome to MkDocs Entangled Plugin

Using this plugin, you can make your Entangled documents look better.

Examples

Detailed examples are found in the entangled/mkdocs-examples repository.

Install

Install this with pip install mkdocs-entangled-plugin. To use the entangled plugin, add the following lines to your mkdocs.yml:

plugins:
  - entangled

markdown_extensions:
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true 

For more information, see the documentation.

Components

This plugin bundles functionality for literate programming with Entangled.

  • Annotate code blocks with titles.
  • Build artifacts using Make.

Annotate code blocks

The default markdown syntax that Entangled supports has fenced code blocks as follows

``` {.python file=examples/hello_world.py}
if __name__ == "__main__":
    <<hello-world>>
```

Which renders like this:

if __name__ == "__main__":
    <<hello-world>>

Or named code blocks

``` {.python #hello-world}
print("Hello, World!")
```

that render like this:

print("Hello, Universe!")

Build Artifacts

Build artifacts by specifying a Makefile.

=== "Figure 1"

    ![](fig/plot.svg)

=== "Source"

    ``` {.gnuplot file=examples/plot.gp}
    # enter your plotting commands here
    ```

    ``` {.make .build-artifact}
    .RECIPEPREFIX = >
  
    docs/fig/plot.svg: examples/plot.gp
    > mkdir -p $(@D)
    > gnuplot $^ > $@
    ```

=== "Figure 1"

![](fig/plot.svg)

=== "Source"

``` {.gnuplot file=examples/plot.gp}
set term svg background rgb 'white' size 700, 500
sinc(r) = sin(pi*r) / (pi*r)
set isosamples 50, 50
set hidden3d
set xrange [-4:4]
set yrange [-4:4]
set xyplane 0
set title "Sinc function"
splot sinc(sqrt(x**2 + y**2)) t'' lc rgb '#5533cc'
```

``` {.make .build-artifact}
.RECIPEPREFIX = >

docs/fig/plot.svg: examples/plot.gp
> mkdir -p $(@D)
> gnuplot $^ > $@
```

License

Licensed under the Apache-2 license agreement: see LICENSE

mkdocs-plugin's People

Contributors

jhidding avatar

Stargazers

Nikolaus Schlemm avatar

Watchers

 avatar

mkdocs-plugin's Issues

toml code type removes file data

when i tried to document a usage example of setuptools_scm,

i added the fence

{ .toml title="pyproject.toml" file="docs/examples/version_scheme_code/pyproject.toml" }
and observed no file created

after i changed it to { .python title="pyproject.toml" file="docs/examples/version_scheme_code/pyproject.toml" } i observed a file being created

its not quite clear to me what im missing there

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.