All Projects → laughedelic → literator

laughedelic / literator

Licence: AGPL-3.0 License
📝 Generate literate-style markdown docs from your sources

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to literator

badge-generator
Magically generate Markdown badges for your docs 🛡️ 🦡 🧙
Stars: ✭ 104 (+89.09%)
Mutual labels:  documentation-tool, docs-generator, documentation-generator
BooGi
Generate GitBook-like modern docs/tutorial websites using Gatsby
Stars: ✭ 117 (+112.73%)
Mutual labels:  documentation-tool, docs-generator, documentation-generator
strictdoc
Software for writing technical requirements specifications.
Stars: ✭ 80 (+45.45%)
Mutual labels:  documentation-tool, documentation-generator
numpydoc.el
Insert NumPy style docstrings in Python functions.
Stars: ✭ 33 (-40%)
Mutual labels:  documentation-tool, documentation-generator
cutedoc
Generate stunning documentation for any project using simple markdown files.
Stars: ✭ 16 (-70.91%)
Mutual labels:  documentation-tool, documentation-generator
Samovar
Stars: ✭ 23 (-58.18%)
Mutual labels:  parsing, documentation-generator
Paradox
Markdown documentation
Stars: ✭ 229 (+316.36%)
Mutual labels:  sbt, documentation-tool
chappe
🧑‍💻 Developer Docs builder. Write guides in Markdown and references in API Blueprint. Comes with a built-in search engine.
Stars: ✭ 132 (+140%)
Mutual labels:  documentation-tool, docs-generator
Redoc
📘 OpenAPI/Swagger-generated API Reference Documentation
Stars: ✭ 15,935 (+28872.73%)
Mutual labels:  documentation-tool, documentation-generator
live-documenter
.NET documentation generator and live reader. Generate documentation from .NET code and xml comments, fast, quick and easy.
Stars: ✭ 64 (+16.36%)
Mutual labels:  documentation-tool, documentation-generator
ank
ΛNK: Compile time docs verification and evaluation for Kotlin and Java (Temporarily moved to Arrow-kt)
Stars: ✭ 52 (-5.45%)
Mutual labels:  documentation-tool, documentation-generator
newdoc
The newdoc tool generates files formatted with AsciiDoc, which are used in Red Hat documentation.
Stars: ✭ 14 (-74.55%)
Mutual labels:  documentation-tool, documentation-generator
Nbdev
Create delightful python projects using Jupyter Notebooks
Stars: ✭ 3,061 (+5465.45%)
Mutual labels:  documentation-tool, documentation-generator
Ford
Automatically generates FORtran Documentation from comments within the code.
Stars: ✭ 245 (+345.45%)
Mutual labels:  documentation-tool, documentation-generator
Dart
DART is a test documentation tool created by the Lockheed Martin Red Team to document and report on penetration tests, especially in isolated network environments.
Stars: ✭ 207 (+276.36%)
Mutual labels:  documentation-tool, documentation-generator
NextBook
NextBook is quick and easy way to build technical books or documentation with markdown that run blazingly fast.
Stars: ✭ 153 (+178.18%)
Mutual labels:  documentation-tool, documentation-generator
Documentalist
📝 A sort-of-static site generator optimized for living documentation of software projects
Stars: ✭ 130 (+136.36%)
Mutual labels:  documentation-tool, documentation-generator
Nbdev template
Template for nbdev projects
Stars: ✭ 161 (+192.73%)
Mutual labels:  documentation-tool, documentation-generator
ocular
A documentation generator for our OSS frameworks
Stars: ✭ 42 (-23.64%)
Mutual labels:  documentation-tool, documentation-generator
tygen
Modern documentation generator for TypeScript built with ReactJS
Stars: ✭ 23 (-58.18%)
Mutual labels:  documentation-tool, documentation-generator

Literator

Generate literate-style markdown docs from your sources

Literator produces a readable document from your code, i.e to helps you to use literate programming when it's not supported by the language itself.

You can write your code using markdown syntax in block comments and then transform it to a markdown document. Then you can generate a nice html or pdf or whatever else, using your favorite markdown processor (for example Pandoc).

Literator is written in Scala and first of all for Scala, but it should work for some other languages as well. Open an issue, if you want support for something else.

Some extra features:

  • generates a list of link definitions for references between files
  • generates a tree-index of the files and (optionally) appends it to each produced markdown file

Usage

Just add following line to your project/plugins.sbt:

addSbtPlugin("laughedelic" % "literator" % "<version>")

(see the latest release version on the badge above)

Note that since v0.8.0 this plugin is published only for sbt-1.x. If you need it for sbt-0.13, use v0.7.1.

To run Literator from sbt, use generateDocs task.

Setting keys

Key Type Default
docsMap Map[File, File] src/docs/src/
docsOutputDirs Seq[File] same as docsMap values
docsAddIndex Boolean false
docsCleanBefore Boolean true

You can set docsMap key in your build.sbt to map source directories to output documentation directories. Using this map you can easily generate docs for several subprojects or integrate certain parts of the source documentation in the general docs (especially if you're using some service like Read the Docs).

Note that output directories are cleaned up before generating docs (you can turn it off with docsCleanBefore := false), so be careful if you're mixing generated docs with handwritten.

Release process integration

If you use sbt-release plugin, you can add docs generation step. See sbt-release documentation for details.

Example

If you have a piece of code like this (it's from the literator sources):

/* ### Block comments parsing */

/* - When parsing the comment opening brace, we remember the offset for the content
     Note that [scaladoc-style comments](http://docs.scala-lang.org/style/scaladoc.html)
     are ignored.
*/
def commentStart: PS =
  spaces ~ (lang.comment.start ^^ { _.replaceAll(".", " ") }) ~
  (((spaces ~ guard(eol)) ^^^ None) | // if the first row is empty, ignore it
   (guard(not("*")) ~> " ".?)) ^^     // not scaladoc and an optional space
  { case sps ~ strt ~ sp => sps + strt + sp.getOrElse("") }

/* - Closing comment brace is just ignored */
def commentEnd: PS = spaces ~ lang.comment.end ^^^ ""

Then it will be transformed into the following markdown:

### Block comments parsing

- When parsing the comment opening brace, we remember the offset for the content
  Note that [scaladoc-style comments](http://docs.scala-lang.org/style/scaladoc.html)
  are ignored.

```scala
def commentStart: PS =
  spaces ~ (lang.comment.start ^^ { _.replaceAll(".", " ") }) ~
  (((spaces ~ guard(eol)) ^^^ None) | // if the first row is empty, ignore it
   (guard(not("*")) ~> " ".?)) ^^     // not scaladoc and an optional space
  { case sps ~ strt ~ sp => sps + strt + sp.getOrElse("") }
```

- Closing comment brace is just ignored

```scala
def commentEnd: PS = spaces ~ lang.comment.end ^^^ ""
```

You can see the result of running Literator on its own sources in the docs/src/ folder.

FAQ

Is this project alive?

Yes, even if you don't see any recent commits/releases. It's just quite stable. In @ohnosequences we used this tool in everyday development and as a part of the release process.

Can I help with development?

Yes, you're very welcome to contribute to the project. Check open issues with the help wanted badge.

Why not docco?

Of course, there are plenty of docco-like tools, which generate htmls from your sources (also using markdown), but there are several reasons, why I don't like them:

  • there is no normal Scala-clone of such tool that you could integrate in the release process
  • most of such tools support only one-line comments and ignore block comments, while the opposite makes more sense: write documentation comments as normal text and keep small technical comments inlined
  • those tools claim to be "quick and dirty", IMO better to have something simple, but reliable
  • Literator helps to keep things simple using markdown which is good as an intermediate format. For example, it's handy to have just markdown documents on github, as it will render them nicely and then generate from them htmls for a web-site if needed using your favorite tool and style templates

Related projects

There are a couple of interesting projects which approach literate programming in Scala from another side:

  • tut reads markdown files and interprets Scala code in tut sheds
  • sbt-scaliterate generates Scala source code from a programming book written in markdown
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].