Coder Social home page Coder Social logo

slack_latex's Introduction

slack_latex

A Latex-rendering app for Slack.

screenshot of slack_latex in Slack

Features

  • Send Slack messages with rendered latex code using a slash command
  • Preview your messages before making them public
  • Edit your messages

Installation

slack_latex is a Slack app, and needs a server to run on. It can be run easily on your machine using a tool like ngrok, or on a PaaS such as Heroku.

Running locally with ngrok

  1. Download the source, navigate into the parent slack_latex directory and run
pip install .
  1. Download and install ngrok and run
ngrok http 4390
  1. Make note of the forwarding url ngrok gives you - you will need it when you're adding the app to Slack.
  2. Complete the steps in the section below to add the app to Slack.
  3. Once you have added the app to Slack, export the token and verification token you received from Slack as environment variables:
export $SLACK_TOKEN=[token]
export $VERIFICATION_TOKEN=[verification token]
  1. Run the app with
python slack_latex/run.py

Note: the files Procfile and runtime.txt are only needed for running on Heroku. If you are not using Heroku, you do not need these files.

Running on Heroku

  1. Set up a (free) Heroku account, and install the Heroku cli. Follow the instructions to login to your Heroku account from the cli.
  2. Navigate into the parent slack_latex directory, and run
heroku create
git push heroku master
  1. Make a note of the url Heroku gives you - you will need it when you're adding the app to Slack. You can find the url by running
heroku open
  1. Complete the steps in the section below to add the app to Slack.
  2. Once you have added the app to Slack, you'll need to configure Heroku with the token and verification token you received from Slack:
heroku config:set SLACK_TOKEN=[token]
heroku config:set VERIFICATION_TOKEN=[verification token]

Adding to Slack

  1. From your Slack team, navigate to the Apps and Integrations page -> Build -> Your Apps.
  2. Create a new app, and fill out the relevant information. Under Basic Information, you will find the verification token for your app. This is the token you should use for the $VERIFICATION_TOKEN variable.
  3. Visit the Interactive Messages section, and under Request URL enter [your url]/button, where [your url] is the url you were given by ngrok or Heroku.
  4. Visit the Slash Commands section, and add two new commands. Name the first /latex, and under Request URL enter [your url]/latex. Name the other /latexedit, and under Request URL enter [your url]/latexedit.
  5. Visit the Slack legacy token page, and obtain a token. This is the token you should use for the $SLACK_TOKEN variable.

Usage

To post a Latex message, use the command /latex [latex code]. The Latex code need not contain $ ... $ or \( ... \). You will then be shown a preview of your message; from there you can either make the message public or edit the message. To edit the message, press the edit button and then use the command /latexedit [latex code].

slack_latex's People

Contributors

www avatar wammies avatar

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.