Giter Site home page Giter Site logo

rsted's Introduction

Simple online editor for reStructuredText on Flask.

Try it where: http://rst.ninjs.org/

Getting setup

Requirements for rsted:

  • Flask
  • rst2html (from Docutils)

These requirements are expressed in the pip-requirements.txt file and may be installed by running the following (from within a virtual environment):

pip install -r pip-requirements.txt

How to run

Your Environment

From within your environment, just run:

./application.py

This will start a server on port 5000. Just visit http://localhost:5000/ in your browser.

Docker

In a docker installed host, just build and run:

docker build -t rsted .
docker run --name rsted --rm -p 5000:5000 rsted

A server starts on port 5000. Please adjust it, if you need another port by changing run command above. And then just visit http://localhost:5000/ in your browser.

rsted's People

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  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  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

rsted's Issues

math2html crashes on malformed math

To reproduce, copy to rst.ninjs.org:
:math:\frac

This also happens with multiline .. math::

Workarounds for user are either

  1. Keep typing and hit reload when math is parseable (works on firefox)
    or
  2. Leave off last backtick until math is parseable (for multiline, don't add .. math:: till equation is done)

Possible suggestions for resolving (not sure how good):

  • Commit patch to math2html, so unparseable math generates some "best effort" or error message in the html, and throws a level 4 error (which rsted will report, but not crash on). The patch will obviously have to be accepted and propagate downstream before this works
  • Catch level 5 errors in rsted, and handle them. For instance keep a copy of the "last known good" html generated, and keep showing that with an added warning. I guess the call to docutils should be wrapped in some handler function for that. If this is the only known error that needs handling in this way, the wrapper could do it only for errors backtracing to math2html.py
  • Find some docutils setting that works around this (I haven't found anything obvious beyond the already used "level 5" error tolerance)

Break up long words and URLs

Is there a way to break up long words or URLs in the source rst documents that will still allow the (link) to be displayed as a single unit. For instance, I have a long link I want to break into two lines in my Python source code (part of a doc string). I also want the resulting RST document to have the line break (for readability without scrolling on smaller screens).

The source:

        :Valid 'blockid' values:

           http://wayback.archive.org/web/20151023030926/https://gist.
           github.com/thinkofdeath/5110835

how it displays:
image

How I would like the same code displayed (or a way to break it up to produce this display):
image

license file

Looks great!!! Please add a license--BSD or MIT?

Thanks!!!

Feature request: save and export to html/pdf

Please make this app more usable by providing an option to save the cache to a file. I'm running on localhost, working perfectly, but I need to save the document in some format so that I don't loose cache.

High CPU usage when idle

When rsted is idle on my server, it's using ~22% of my CPU. That seems pretty high. I don't see any relevant messages in the log file. Any ideas?

README

To start, I need more requirements:

packages
pip or sometimes names python-pip (executable is sometimes named pip-python)
python-devel (for header files)

for pip:
reportlab

Correctly numbered, nested auto-enumerated lists?

From this example:

#. First, We'll Take Manhattan

  #) Then
  #) We'll
  #) Take
  #) Berlin

#. Enumerate at two.

Renders as:

1. First We'll Take Manhattan
  1. Then
  2. We'll
  3. Take
  4. Berlin
1. Enumerate at two.

Rather than:

  1. First We'll Take Manhattan
    1. Then
    2. We'll
    3. Take
    4. Berlin
  2. Enumerate at two.

footnote with > 1 paragraph

If a footnote has > 1 paragraph, others than first one are not v-aligned under beginning of footnote's first paragraph (but they start on left margin).

http://rst.ninjs.org/ is out of date

A number of RST markup directives are not recognized on the website http://rst.ninjs.org/ although they work fine on a local installation with the latest versions of all dependencies. Any chance you'll update the site?

Great project, by the way, I have found it super useful for getting my README files in shape for PyPI.

Add 'code-block' directive and Pygments parsers

Hi.
I am not very familiar with reST, Sphinx and all these. But somethimes I want to extend the documentation of a project (e.g. Symfony) and this online editor is really great for this task ;-) thanks!

But I am missing the code-block directive and the parsing of different languages like "jinja" for example. Symfony uses it, please look at http://symfony.com/doc/current/contributing/documentation/format.html#syntax-highlighting

I am not sure if Pygments is automatically integrated in Sphinx and for that reason this issue may be obsolete because of #9

bold 'button' can not work

I found when I click bold button, the word just display word.
The reason is it should separate at least one space with previous word.
So, I think it should modify.
And this problem also occurs on other buttons.

Some hotkey is used by Chrome, eg. Ctrl-1, ctrl-2, ctrl-T

Could we choose different hotkey set or customize them?

Preview window should follow edit window cursor position

Just an enhancement suggestion:

It would be nice if the position of the preview window automatically showed the text that was being input. If I'm editing a document longer than the height of the window, the preview should scroll with me.

I'm not yet sure how this would be implemented. Might be able to get away with scrolling the preview area to the same percentage of its total scroll height as the edit area.

edit multiple rst require change the browser tab's title

I like this editor. I'm wonder if it possible to change browser's tab title for the rst content. (I use chrome)

The simple algorithm for show correct title is:

if first_line.prefix == ".. contents::" then
show the rest part of first line
else if first_line.prefix == "==" then
show 2nd line
else
show first line

Download rst and html

Hi!

It could be useful to get a download button to save rst file, and also a download button to save generated html.
Then it could be used as an online rst wordprocessor with live rst syntax checker and preview.

Nice job.

When I make mistake on rst content, it hangs

For example.
SystemMessage: :3: (SEVERE/4) Title overline & underline mismatch.

Traceback (most recent call last)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1518, in call
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1506, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1504, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1264, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1262, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1248, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/dlin/tools/rsted/application.py", line 60, in rst2html
html = _rst2html(rst, theme=theme)
File "/home/dlin/tools/rsted/rsted/html.py", line 32, in rst2html
out = publish_string(rst, writer_name='html', settings_overrides=rst_opts)
File "/usr/lib/python2.7/site-packages/docutils/core.py", line 401, in publish_string
enable_exit_status=enable_exit_status)
File "/usr/lib/python2.7/site-packages/docutils/core.py", line 649, in publish_programmatically
output = pub.publish(enable_exit_status=enable_exit_status)
File "/usr/lib/python2.7/site-packages/docutils/core.py", line 211, in publish
self.settings)
File "/usr/lib/python2.7/site-packages/docutils/readers/init.py", line 69, in read
self.parse()
File "/usr/lib/python2.7/site-packages/docutils/readers/init.py", line 75, in parse
self.parser.parse(self.input, document)
File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/init.py", line 157, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 170, in run
input_source=document['source'])
File "/usr/lib/python2.7/site-packages/docutils/statemachine.py", line 237, in run
context, state, transitions)
File "/usr/lib/python2.7/site-packages/docutils/statemachine.py", line 458, in check_line
return method(match, context, next_state)
File "/usr/lib/python2.7/site-packages/docutils/parsers/rst/states.py", line 2926, in text
source=src, line=srcline-1)
File "/usr/lib/python2.7/site-packages/docutils/utils.py", line 232, in severe
return self.system_message(self.SEVERE_LEVEL, _args, *_kwargs)
File "/usr/lib/python2.7/site-packages/docutils/utils.py", line 190, in system_message
raise SystemMessage(msg, level)
SystemMessage: :3: (SEVERE/4) Title overline & underline mismatch. ============== My Section Content =============

List icons are misleading

The Numbered and Bulleted list icons are misleading. They appear to the layman to be buttons for "Quote" and "Code".

By the way, actual Quote and Code buttons would be nice too.

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.