yarffaJ nalA (jnala) wrote in lj_dev,
yarffaJ nalA
jnala
lj_dev

reStructuredText

*Update*: Implementation section updated for clarity.

-----

I would like to add reStructuredText_ support to LiveJournal.
reStructuredText is a markup language which aims to be

1) very lightweight
2) very intuitive
3) readable in source form
4) suitable for many output formats

It's a pleasant markup which (IMHO) combines 95% of the power of XML
with 95% of the ease of use of plain text.  I think a lot of people
would choose to write LJ entries with it, if given the option.

For example, this message is an example of a valid reStructuredText_
document.  The list above is correct syntax for an enumerated list,
and the words with underscores after them are syntax for hyperlinks.
Paragraphs and literal text and horizontal rules and bullet lists are 
just as easy.

Even constructs like lj-user are easy to express.  Here's an lj-user
link to me: |Alan|

The only catch is that the parser written in Python.  The `Perl module`_
currently requires Inline::Python and a Python installation.  This is
a large added dependency - easy to install, but large - and means
someone installing LiveJournal on their own site should be able to
disable reStructuredText support if they don't want to install Python.

The FCGI Perl processes handling posts would end up running
embedded Python processors, moderately increasing RAM usage.
Alternately rST parsing could happen in a completely separate
process.  We'd also need to store both the source and the 
generated HTML in the database, slightly increasing record size.

Or we could generate HTML on the fly, as is currently done with
autoformatted entries, but then every FCGI would have to run a
Python and there'd be more of a CPU hit.  Probably not the way
to go.

Is this a showstopper?

The other change is client-side; instead of a "do/don't autoformat
entry", clients should present an input format pulldown, with the
choices "plain text", "raw HTML", and "reStructuredText".

Thoughts?

.. _restructuredtext: http://structuredtext.sourceforge.net/
.. _perl module:      http://pobox.com/~jaffray/rst/
.. |Alan| lj-user::   alanj
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 32 comments