To display Git patches parsed by mdg:tutorial-step-diff-compiler
in a nice code box, use the mdg:tutorial-diff-box
package.
meteor add mdg:tutorial-diff-box
Features
The code box currently displays:
- The step number and commit message in the top left
- Filename and link to GitHub in the top right
- Code with gray background for context and green background for changed/added lines, code highlighted based on the file extension of the file
Usage
This assumes you have already done the steps to set up the patch build plugin.
In your client-side JavaScript code, register a tutorial:
1DiffBox.registerTutorial("simple-todos", { 2 gitHubRepoName: "meteor/simple-todos", 3 patchFilename: "simple-todos.multi.patch" 4});
This is used to generate the links to GitHub, and reduce the amount of boilerplate by defining a short name like "react" instead of "react.multi.patch".
Now you should be able to use diff boxes in your Spacebars templates:
1{{> DiffBox tutorialName="simple-todos" step="4.1"}}