Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Writing Exercises: Modules

beneater edited this page Oct 31, 2011 · 8 revisions

Using Modules

Depending upon the type of exercise that you're writing you'll likely need to load one or more utility modules in order to render the exercise correctly. This can be done by specifying a data-require="..." attribute on the HTML element of the page.

There are an ever-increasing number of modules (you can find them in the utils/ directory) but the ones that you'll most-likely need are:

  • math (for math-related formulas and utility methods)
  • math-format (often used for formatting fractions)
  • graphie (for everything from drawing geometric shapes to plotting functions)
  • word-problems (for word problems)

There are also utils for angles, calculus, exponents, kinematics, probability, etc.

We just started working on [documenting all of the utility functions] (https://github.com/Khan/khan-exercises/wiki/Utility-Module-Reference). A great way to help out and become more familiar with the modules is to help us expand the documentation by editing the reference wiki. Feel free to adjust formatting, re-organize, whatever makes it easier for everyone to find the utility modules they need.

<!DOCTYPE html>
<html data-require="math word-problems"> <!-- Your modules go on this line... -->
<head>
	<title>Name of Your Exercise</title>
	<script src="../khan-exercise.js"></script>
</head>

Back to Writing Exercises: Home