GithubHelp home page GithubHelp logo

discedit's Introduction

Edit Discourse topics locally

The discedit tool allows you to edit Discourse topics in your favourite local text editor. It works by pulling a topic from Discourse, opening it in a local text editor and automatically pushing the edits.

Requirements

discedit requires:

  • Go, installed locally
  • a Discourse API key for the instance you want access to (see below)

Get started

Install discedit

1. Clone this repository and navigate into the directory:

git clone https://github.com/niemeyer/discedit.git
cd discedit

2. Compile the application:

go build

Configure discedit with your Discourse key(s)

For each Discourse instance that you want to interact with, you need to create an API key in the Discourse admin. Select:

  • User Level: Single User
  • Global Key (allows all actions)

If you don't have the rights to handle keys, the administrator of your Discourse installation will need to create the key for you.

Create a file ~/.discedit in the following format:

forums:
    https://some.discourse.domain:
        username: your-username
        key: your-key

Edit a topic with discedit

In the directory where you built discedit, run:

./discedit <forum topic URL>

The topic will pull down the topic as a file, and open it in your system's preferred editor. When you close the file, discedit will push the content (if it has changed) back to Discourse.

Refinements

Add an alias

It's more convenient to be able to run discedit from anywhere, not just the discedit repository; add an alias, for example:

alias discedit="~/Repositories/discedit/discedit"

Use live edit mode

The -live-edit option will push your changes to Discourse on save, not just on closing the file (this can also be included in any alias you set up):

discedit -live-edit <forum topic URL>

Use the clipboard

Rather than having to paste the topic URL each time, you can read it straight from the clipboard (note use of single quotes to ensure that the commands are expanded when the alias is used, rather than when it's created):

For Linux: discedit '$(xclip -o -selection -c)'

For macOS: discedit '$(pbpaste)'

Reference

discedit options are:

  • -debug: Debug mode
  • -force-draft: Open draft even if it has conflicts
  • -ignore-draft: Ignore existing draft and start over
  • -live-edit: Update post while content is being edited

discedit's People

Contributors

niemeyer avatar evildmp avatar pedroleaoc 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.