markdown editor

General chit chat about razor, not specifically related to a topic but about razorCMS

markdown editor

Postby Pumpapa » Thu Aug 22, 2013 9:49 pm

Any plans/ideas to create a markdown / multimarkdown editor?

Currently my process to edit content is IA-Writer (does markdown) then export as html then cut and paste the html in razor.
Works fine but requires some avoidable handwork.

Cheers
Pumpapa
 
Posts: 5
Joined: Thu Nov 15, 2012 2:33 pm

Re: markdown editor

Postby Adminer » Fri Aug 23, 2013 10:42 am

Pumpapa wrote:Any plans/ideas to create a markdown / multimarkdown editor?


Why do you need this one? ;-)
I can find a piece of php code about this here: http://michelf.ca/projects/php-markdown/
but... I still don't know, why I should use it...

In RazorCMS we had tested many editors:
- ckEditor: http://razorcms.co.uk/editors.htm
- EditArea,
- NicEdit,
- TinyMce,
- ELRTE,
- CLEDITOR - http://premiumsoftware.net/CLEditor/Downloads ,
- MARKITUP,
etc...

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: markdown editor

Postby Pumpapa » Fri Aug 23, 2013 1:11 pm

A fair question with a complex answer. Sorry 'bout the rant :-)

I use dropbox to sync all content I produce across all my computers and tablets (10+). That way I have backups and version mngmnt.

I am a software engineer and architect and I like all artifacts being explicitly represented.

I dislike msft Word and styles and templates in Word: the end-product is the result of a complex interaction partly based on invisible/implicit data. A second document is about as much work as the first: templates and styles are difficult to copy, and Word changes every couple of years. Google docs seemed an answer but has quickly gone the same way as msft: WYSIWYG which for is short for "What you don't see or can't access may become a problem at any moment". (I dislike wysiwyg on top of but hiding HTML)

I've just started using markdown together with HTML and CSS print stylesheets. Works great for simple documents.

Similarly I dislike db-based CMSs because backups and version mngmnt are nonexistent or difficult and different in each CMS (I've used many), and the end-product is th enet result of (sometimes) years of interaction without any explicit representation (other than the db and file systems).

That is why I use razorcms if at all possible.
But of itself there is no (content) version management.
So for content-centric sites I use markdown stored in dropbox, exported to html and cut and pasted into RazorCMS. Somewhat cumbersome, but all content is plain (markdown) text plus graphics. The entire site is under version management with backups. See http://www.busbaannee.nl/

This situation could be improved by
    * Adding an optional filter in RazorCMS which in the chain from .txt file to assembled HTML is capable of (optionally) converting a markdown .txt file to the corresponding html text;
    * Allowing me to push .txt files from a version management system to the datastore/pages/ directory in a site
    * If i would be capable to map slab names to file names I would have something truly spectacular: a website driven from a version management system!

Thinking about this led to my question.
Pumpapa
 
Posts: 5
Joined: Thu Nov 15, 2012 2:33 pm

Re: markdown editor

Postby Adminer » Sat Aug 24, 2013 12:59 pm

Pumpapa wrote:I am a software engineer and architect and I like all artifacts being explicitly represented.


Hmm...
Is this link about this? ->
http://sourceforge.net/p/monstra-cms/di ... own_syntax

In RazorCMS it should be like a blade pack. So you must have to create two files:
- first one, for example: system_markdown.xml

Code: Select all
<?xml version="1.0" ?>
<bladepack>
    <details>
        <name>markdown</name>
        <version>v1.0</version>
        <class>system</class>
        <author>Author</author>
        <description>Adds the power of markdown the all in one editor</description>
    </details>
    <archive>
        <archive_file>system_markdown.zip</archive_file>
        <xml_file>system_markdown.xml</xml_file>
        <bladepack_file>system_markdown.php</bladepack_file>
        <bladepack_dir>system_markdown</bladepack_dir>
    </archive>
    <note>
        <p>This blade pack will embed an editor into the text box in content creation areas.</p>
    </note>
</bladepack>


- second file, for example: system_markdown.php

Code: Select all
///////////////////////
// Socket Allocation //
///////////////////////

// Add Blades to Sockets //
$bladeList['markdown'] = 'editor';


///////////////////////
//      Blades       //
///////////////////////


function markdown(&$te) {
   if($_SESSION['adminLogIn']) {
    #
    # Initialize the parser and return the result of its transform method.
    #
        # Setup static parser variable.
        static $parser;
        if (!isset($parser)) {
            $parser_class = MARKDOWN_PARSER_CLASS;
            $parser = new $parser_class;
        }
      # Transform text using parser.
      $parser->transform($te[4]);

$te[2] = '<textarea id="editor" name="content" rows="30" style="width: 98%">'.$te[4].'</textarea>';
       
        return $te[2];
    }
 }

 #
    # Global default settings:
    #

    # Change to ">" for HTML output
    @define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX',  " />");

    # Define the width of a tab for code blocks.
    @define( 'MARKDOWN_TAB_WIDTH',     4 );


    @define( 'MARKDOWN_PARSER_CLASS',  'Markdown_Parser' );

#
# Markdown Parser Class
#

class Markdown_Parser {

    # Regex to match balanced [brackets].
    # Needed to insert a maximum bracked depth while converting to PHP.

.... etc.


You can find example of Markdown conversion in one simple plugin to another CMS:
http://forum.monstra.org/topic/118/markdown/
So, it's maybe useful to do an adaptation for RazorCMS. I'm not testing this...

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland

Re: markdown editor

Postby Pumpapa » Sun Aug 25, 2013 9:24 am

@Adminer: thanks for taking the time.

Is this link about this? ->
http://sourceforge.net/p/monstra-cms/di ... own_syntax


I've briefly looked at Monstra. The documentation and forum feedback are very terse. The markdown plugin works as that in Drupal, Wordpress and many other cms's.
When I find the time in a next project I will look at creating a blade pack which does this like you suggest (php isn't my language of choice :? )

The second part of my rant, syncing content against a version management system, still needs some thinking though.

Cheers.
Pumpapa
 
Posts: 5
Joined: Thu Nov 15, 2012 2:33 pm


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron