Giter VIP home page Giter VIP logo

literate-rs's Introduction

literate-rs

A literate programming tool that allows writing code in your Markdown files.

Badges

Build License Crates.io Version Docs.rs Version

How it works

At its core literate reads a file from standard in and outputs code blocks to standard out as a single stream. The code blocks may be filtered by various qualities such as language, attributes, etc.

The real magic

Although literate itself is very simple, the magic really happens when you apply the tool to entire directories. For example, a Rust project could add literate to their build.rs in order to write their examples as Markdown files that become Rust files at build time. Since Rust has a very mature documentation culture, the actual source may not benefit as much from literate. However, one can easily envision a tool that flips Rust's documentation on its head. Instead of doc comments, Rust source could be defined as Markdown files. During build, the file could be parsed to add the surrounding text as a doc comment to the code block code. User's could plug in different strategies for traversing up the tree to find the relevant documentation.

Testing

cat .\examples\tortuga.ta.md | literate --language tortuga --required

literate-rs's People

Contributors

misalcedo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dilawar

literate-rs's Issues

Improve documentation

  • Add instructions to the README on how to install
  • Add doc comments for the public interface of the library.
  • Add tests for the public interface of the library.
  • Create example of how to integrate the library, for example how we plan to use it for Tortuga
  • Document all features

Add a tree walking extractor feature

Add an optional feature to walk a directory tree, filter files, apply extraction, and write to a new file.

The library needs a new function to walk the dir tree that takes a file matcher, input path, language matcher, and file renamed.

The output path is determined by the file renamed to allow for changing the tree structure during the walk.

The library needs to provide a default file filter for a file extension of choice that is .ext.md and a file renamed that maintains the input structure but strips off the .md extension.

Finally add this to the cli as a new command and leave the old functionality as the default / no command.

Cargo integration

Integrate literate's walk functionality with Cargo by adding it to a build.rs file.

Add support for `head`

Rust println and write fail when used with head with a BrokenPipe. Need to catch this error in the CLI so that extract can work with head, tail, more, and less

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.