Skip to content

Repository files navigation

mathbook-assets

Styles and scripts for the Mathbook platform.

Getting Started

You've just cloned the repo. What now?

  1. Install Ruby, if it is not already installed. You may want to use RVM or rbenv so that you can use multiple versions of Ruby on the same machine.

  2. Install Compass.

  3. Run the boostrap script from the repo's root directory. This performs local repository setup like initializing githooks.

     $ ./scripts/bootstrap.sh
    

Deploying Assets

To deploy the current state of the repository from an arbitrary directory:

$ ./path/to/repo/scripts/generate.sh ./path/to/output

To deploy all branches from a directory outside the repository:

$ ./path/to/repo/scripts/generate-branches.sh ./path/to/output

Using Mathbook.js

Note: Mathbook.js currently instantiates Mathbook automatically. Until that is changed, this section should be disregarded.

You can instantiate a default Mathbook instance as follows:

// Mathbook must be initialized after the DOM has loaded$(window).load(function(){w.mathbook=newMathbook();});

You can also pass an options object to the constructor. This overrides the defaults defined in Mathbook.js. For the full list of available options, see that file. They are (hopefully) well commented.

Here's an example of a customized Mathbook instance:

$(window).load(function(){// Attach our instance to the window object // so we can find it againwindow.mathbook=newMathbook({selectors: {// Change the selector used to find section linkssectionLinks: ".argle-bargle-link"},// Change the attribute used to store the hash // for in-page section linkssectionLinkHashAttribute: "data-hash",onEnterSection: function(){if(typeof_trackEvent==="function"){// push an event to google analytics_trackEvent("ENTER_SECTION",this.id);}},onExitSection: function(){if(typeof_trackEvent==="function"){// push an event to google analytics_trackEvent("EXIT_SECTION",this.id);}},// Tell it whether or not to only track sections that // are linked from the ToCshouldTrackOnlyLinkedSections: false});});

Contributing

Please see the Contributors Guidelines before contributing to this project.

About

Styles and scripts for the Mathbook platform.

Resources

Contributing

Stars

0 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages