Code Monkey home page Code Monkey logo

browse's Introduction

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

Usage

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

  -Xplugin:<path-to-sxr>/sxr-0.3.0-SNAPSHOT.jar
  -P:sxr:base-directory:<src-dir>

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)
}

browse's People

Contributors

harrah avatar olim7t avatar jrudolph avatar randompearl avatar char101 avatar jaceklaskowski avatar jvtrigueros avatar rorygraves avatar

Watchers

 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.