socco-ng is a Scala compiler plugin to generate documentation from Scala source files. This is a fork from criteo/socco.
It produces HTML documents that display your comments alongside your code. Comments are passed through Markdown, and the Scala code is syntax highlighted, typed and linked to the appropriate API Doc.
If you use SBT, add the following settings to enable the plugin:
autoCompilerPlugins := true
addCompilerPlugin("io.regadas" %% "socco-ng" % "0.1.2")
If you are using scalac directly, add the following option:
-Xplugin:io.regadas.socco-ng_2.12-0.1.2.jar
This can be followed by any of the available options:
-P:out:$outDir
to specify the output directory.-P:style:$stylesheetPath
to specify a custom stylesheet.-P:packagge_$packageName:$scalaDocUrl
to specify a Scala API doc to link.-P:header:$headerPath
to specify a custom HTML header.-P:footer:$footerPath
to specify a custom HTML footer.
The plugin will handle all scala source files starting with a comment line like:
// Example: (.*)
The captured group will be used as the example title in the generated HTML documents.
The comments can use markdown syntax, and will be correctly rendered to the generated documentation.
Also, there is a special kind of comment:
// @className
When added on top of a code block, it will add the CSS class to the generated block. Allowing you to style it further wit CSS.
- Docco generates this kind of layout for coffeescript code. It has been ported to several other languages.
- Tut is a documentation tool that allow to embed (and compile) scala code into Markdown documents. Which is exactly the opposite of Socco ๐.
- SXR is Scala compiler plugin that turn source code into syntax highlighted and browsable HTML documents. It is outdated now but was a good source of inspiration for socco.
This project is licensed under the Apache 2.0 license.