Skip to content

Instantly share code, notes, and snippets.

@Marak
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marak/78fbb714721b1d14c4df to your computer and use it in GitHub Desktop.
Save Marak/78fbb714721b1d14c4df to your computer and use it in GitHub Desktop.
hook.io hook for testing substack's fraktur
module['exports'] = function (hook) {
var fraktur = require('fraktur');
// assumes text has been posted as form data or is part of query string
// you could just as easily parse hook.req for incoming data instead
hook.res.end(fraktur(hook.params.text));
};
module['exports'].schema = {
"text": {
"type": "string",
"default": "Why, Hello there kind sir!"
}
};
<!DOCTYPE html>
<html>
<head>
<title>fraktur example</title>
<meta charset='utf-8'>
<style>
.output { font-size: 48px; }
input { font-size: 22px; width: 400px; }
submit { font-size: 22px; }
</style>
</head>
<body>
<div class="output"></div>
<br/>
<form method="POST" action="">
<input type="input" name="text" value="Why, Hello there kind sir!"/>
<input type="submit" name="run" value="Test Hook"/>
</form>
</body>
</html>
module['exports'] = function (opts, cb) {
var $ = this.$;
// $ now contains the view.html fragment
$('.output').html(opts.output);
return cb(null, $.html());
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment