Giter VIP home page Giter VIP logo

socco-ng's Introduction

socco-ng

build GitHub license Maven Central

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.

Usage

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.

Syntax

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.

Prior art

  • 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.

License

This project is licensed under the Apache 2.0 license.

socco-ng's People

Contributors

dependabot[bot] avatar guillaumebort avatar kellen avatar nevillelyh avatar regadas avatar scala-steward avatar

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.