A Scala source code browser
Scala JavaScript CSS
Latest commit 8ffa3d4 Jan 13, 2014 @harrah Merge pull request #23 from jvtrigueros/patch-1
Updated plugin reference location.
Failed to load latest commit information.
src/main Fix for #16 - case classes defined in methods cause error Jan 2, 2014
test Fix for #16 - case classes defined in methods cause error Jan 2, 2014
testLink Test external linking. Sep 23, 2013
.gitignore Nathan's patches for using jQuery Apr 22, 2009
LICENSE more from olim7t: abstracting writers May 22, 2010
README.md Updated plugin reference location. Jan 13, 2014


Browsable Scala source code in HTML with:

  • syntax highlighting
  • types/applied implicits in tooltips
  • references/definition highlighted on mouseover
  • links to definition

See http://harrah.github.com/browse/samples/index.html for samples.

Still in development. Bugs are features and features are accidental.

To build with sbt (see http://scala-sbt.org/release/docs/Getting-Started/Setup.html for setup instructions):

$ sbt package

This produces a compiler plugin in target/.


Add the following options to your compile command for your project:


If you are using sbt, add sxr as a compiler plugin and configure it:

resolvers += Resolver.url("Typesafe Releases", url("http://repo.typesafe.com/typesafe/ivy-releases"))(Resolver.ivyStylePatterns)

addCompilerPlugin("org.scala-sbt.sxr" %% "sxr" % "0.3.0")

scalacOptions <+= scalaSource in Compile map { "-P:sxr:base-directory:" + _.getAbsolutePath }

You will get a directory .sxr that mirrors the directory structure of your sources relative to the specified base directory with one HTML file for each source file. You can make simple changes to the syntax highlighting in the style.css file in the root output directory. The linked.js file implements the highlighting of refererences, among other things.

Other options include specifying the output format and linking to other sxr sources.

To link to other sxr sources (produced with sxr 0.2.5 or later), follow these two steps.

  1. put the URLs of the other sxr sources in a file, say 'sxr.links'. The URLs should point to the base directories, not to 'index.html' or any specific file.
  2. Specify the location of this file in the 'link-file' sxr option. For example, in addition to the settings above, use:
scalacOptions <+= baseDirectory map { base =>
  val linkFile = base / "sxr.links"
  "-P:sxr:link-file:" + linkFile.getAbsolutePath)