Giter Site home page Giter Site logo

mathslax's Introduction

MathSlax

A typesetting solution for all of your Slack chat needs.

Dependencies

Requires Java, nodejs and NPM.

$ sudo apt-get install nodejs npm default-jre
$ sudo apt-get install openjdk-8-jdk # unless a JDK is already installed

Set up

$ cd mathslax
$ make install
$ SERVER=myhostname.com PORT=9999 SLACK_AUTH_TOKEN="..." node server.js

Set up an outgoing web hook in Slack pointing to myhostname.com:9999/typeset (don't forget the /typeset). Use math! as the prefix. And set the outgoing token to match

Usage

In the Slack channel with the web hook configured, you should be able to typeset equations by starting your message with math!. For example, math! x^2 * sin(x) would cause the mathslax bot to comment with a link to a typeset image of x^2 * sin(x).

Slash command

You can also use this as a slash command, provided the POST URL is /slashtypeset instead of /typeset. And set the outgoing token to match

Note About Debian/Ubuntu node vs nodejs

The npm install step can produce hard to diagnose errors on Debian derived systems (such as Ubuntu 12.x and later). The binary /usr/bin/node was renamed to /usr/bin/nodejs and many packages in npm do not expect this. You can either create a link yourself from /usr/bin/node -> /usr/bin/nodejs or use one of the other various solutions out there (including attempting to use the package nodejs-legacy). Good luck!

mathslax's People

Contributors

colbygk avatar dragly avatar iblislin avatar lawngnome avatar peterldowns avatar visvirial avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mathslax's Issues

npm module 'process' not installed

Not sure if this is an issue with mathslax, my configuration, or some combination thereof, but I thought I'd drop a message here anyway.

After installing mathslax according to the provided instructions on Ubuntu 14.04.5 LTS (including creating the link from /usr/bin/node -> /usr/bin/nodejs), attempting to start mathslax resulted in the following:

john@JohnServer:~/slack_math/mathslax$ SERVER=myurl PORT=9999 node server.js

module.js:340
    throw err;
          ^
Error: Cannot find module 'process'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Function.sre.SystemExternal.require (/home/john/slack_math/mathslax/node_modules/MathJax-node/node_modules/speech-rule-engine/lib/sre.js:53:256)
    at Object.<anonymous> (/home/john/slack_math/mathslax/node_modules/MathJax-node/node_modules/speech-rule-engine/lib/sre.js:53:403)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

npm install process seemed to resolve the issue.

Mathslax doesn't produce a response

I installed mathslax on my server and set up the webhook on Slack. I have all the dependencies installed and make install doesn't produce any error messages. The mathslax server echoes any requests I send via curl or Slack, but never returns a response. There are no other error messages - when I send a request via curl, it just hangs forever waiting for a response.

Allow Responses in Direct Messages?

Sorry, I wasn't sure where to ask this question. I can see here that slackbot itself is not allowed or able to respond in direct messages.

Is this a limitation of bots, or is there a way to allow mathslax to work in direct messages?

mathslax doesn't work with node 7.4

I'm having trouble getting mathslax to work with the newest version of node (on Ubuntu 16.04). I have not tried it with other versions.

$  git clone https://github.com/colbygk/mathslax.git
Cloning into 'mathslax'...
$ cd mathslax
$ npm install
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Deprecated, use jstransformer

> [email protected] install /home/mathnode/src/mathslax/node_modules/contextify
> node-gyp rebuild
``` make: *** [Release/obj.target/contextify/src/contextify.o] Error 1 make: Leaving directory '/home/mathnode/src/mathslax/node_modules/contextify/build' gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/mathnode/node-v7.4.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 4.4.0-62-generic gyp ERR! command "/home/mathnode/node-v7.4.0-linux-x64/bin/node" "/home/mathnode/node-v7.4.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/mathnode/src/mathslax/node_modules/contextify gyp ERR! node -v v7.4.0 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok ```

I've read after some googling that contextify is not required for modern node installations. I'm not sure what is trying to install it though. I've tried messing around with package.json to force newer versions of the supporting libraries, but I haven't gotten it to work yet.

Any way to force small displays to appear as small images?

Hey there! I installed the software and got it working, and I was wondering if there's a way to make the images display smaller when the math text dispaly is itself smaller. Right now, it displays absolutely huge, specifically, the smaller the display, the more crazy the image.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.