-
Notifications
You must be signed in to change notification settings - Fork 857
Contributing
Building remark requires you to have the following software installed:
In addition to cloning the remark repository, it's git sub modules and node package dependencies must be installed as well:
git clone https://github.com/gnab/remark.git
cd remark
git submodule update --init --recursive
npm install
To build remark, there's one final command to execute:
node make
This will trigger the all
target in the Makefile-like make.js file producing out/remark.js and the minified out/remark.min.js.
The all
target comprises the targets lint
, test
, bundle
and minify
, any of which can be run individually by issuing node make <target>
.
In addition to building remark itself, there's an additional highlighter
target that will bundle Highlight.js into the src/remark/highlighter.js file.
node make highlighter
This will bundle Highlight.js itself, its styles (with a few exceptions), and the languages specified in the package.json file:
{
...
"config": {
"highlighter": {
"languages": [
"javascript",
"ruby",
...
]
}
}
}
By setting the config.highlighter
property to false
, an empty highlighter skeleton will be inserted instead of Highlight.js when triggering the highlighter
target, effectively causing Highlight.js to be excluded from the build:
{
...
"config": {
"highlighter": false
}
}
If you will be using remark without any code that needs to be syntax highlighted, this lets you build a light-weight version (remark.min.js ~62 kB).
Specifically, make sure you download at least commit 3adfe3d9f0dbbc123d65b7a5e421526814424a1e or later (check like so)
$ git log
commit 3adfe3d9f0dbbc123d65b7a5e421526814424a1e
Author: Ole Petter Bang <olepbang@gmail.com>
Date: Tue Oct 25 22:00:46 2016 +0000
#379: Enable excluding highlight.js from build.
Then add "config" : { "highlighter": false }
to package.json as shown above. Then run the following commands
$ node make highlighter
$ node make lint
$ node make build
$ node make minify
This will build a minified version of remark.min.js around 62 KB.
Note: If you intend to use an external highlighter or some other code coloring library in your slideshow, make sure you include the library and its css in the webpage and use the following to start the slideshow
window.onload = function() {
var slideshow = remark.create({
… options …
});
// highlight any code in the current slide
slideshow.on('showSlide', function (slide) {
hljs.initHighlighting();
});
}
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
Code:
def add(a,b)
a + b
end
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
</script>