Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Markitup

waebi
2011-03-22
2013-06-03
  • waebi
    waebi
    2011-03-22

    Has anybody already played around with the "Markitup" editor? It can be found in scripts/plugins/markitup.
    I found that there is more BB code defined than is available in the editor. How can one set them free?

    I particularly would appreciate:
    for superscript
    for subscript

    • to create lists
      to create tables
      to attribute another color to parts of text
      to change background color of parts of the text

    I do not consider this as a new feature request because most of these features already exist in "markitup". They simply are not available.

    Have a nice day ;-)

     
  • waebi
    waebi
    2011-03-22

    Oh gosh. I did not think that the editor here can understand some tags!!! Sorry for above!

    I would appreciate to have:
    - "sup" for superscript
    - "sub" for subscript
    - "list" to create lists
    - "table" to create tables
    - "textcolor" to attribute another color to parts of text
    - "bg_color" to change background color of parts of the text

    Again sorry for initial posting that did execute some of the BB code.

     
  • nabber00
    nabber00
    2011-03-23

    Unfortunately sphpblog uses its own parser and not a "standard" BBCode parser.  I'd have to implement those functions myself for not much gain.  What I really want to do is replace it with some kind of HTML based system so you aren't limited to just BBCode tags.

     
  • waebi
    waebi
    2011-04-08

    OK, I did it myself. If somebody wants the tags for subscript, superscript, lists and tables, then write a comment here and I'll publish the modifications to be done.

    The BB code parser is awful. It mixes up HTML and BB code.
    When I find a bit more time, I'll integrate the full "markitup" set.

    Fot the textcolor and the background color I haven't found a solution yet.

     
  • Peter
    Peter
    2012-07-20

    waebi, I would like to know the bbcode markitup modifications you made to achieve this…Cheers appreciated.

     
  • Peter
    Peter
    2012-07-28

    Ok. I think I worked this out…is working for me anyway!

    In scripts/sb_formatting.php  find these similar lines and replace with this.

    if ( $comment_mode ) {
                $tag_arr = array();
                if ( in_array( 'i', $allowed ) ) { array_push( $tag_arr, 'i' ); }
                if ( in_array( 'b', $allowed ) ) { array_push( $tag_arr, 'b' ); }
                if ( in_array( 'u', $allowed ) ) { array_push( $tag_arr, 'u' ); }
                if ( in_array( 'blockquote', $allowed ) ) { array_push( $tag_arr, 'blockquote' ); }
                if ( in_array( 'strong', $allowed ) ) { array_push( $tag_arr, 'strong' ); }
                if ( in_array( 'table', $allowed ) ) { array_push( $tag_arr, 'table' ); }
                if ( in_array( 'td', $allowed ) ) { array_push( $tag_arr, 'td' ); }
                if ( in_array( 'tr', $allowed ) ) { array_push( $tag_arr, 'tr' ); }
                if ( in_array( 'em', $allowed ) ) { array_push( $tag_arr, 'em' ); }
                if ( in_array( 'hN', $allowed ) ) { array_push( $tag_arr, 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ); }
                if ( in_array( 'del', $allowed ) ) { array_push( $tag_arr, 'del' ); }
                if ( in_array( 'ins', $allowed ) ) { array_push( $tag_arr, 'ins' ); }
                if ( in_array( 'strike', $allowed ) ) { array_push( $tag_arr, 'strike' ); }
                if ( in_array( 'pre', $allowed ) ) { array_push( $tag_arr, 'pre' ); }
                if ( in_array( 'code', $allowed ) ) { array_push( $tag_arr, 'code' ); }
                if ( in_array( 'center', $allowed ) ) { array_push( $tag_arr, 'center' ); }
            } else {
                $tag_arr = array('i', 'b', 'blockquote', 'strong', 'table', 'td', 'tr', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'del', 'ins', 'strike', 'pre', 'code', 'center', 'u' );
            }
    

    Then for the style.css you will need to add this

    .markItUp .markItUpButton17 a   {
        background-image:url(images/table.png);
    }
    

    And upload a small .png for the table.png image.

    In set.js you will add this

    {name:'Table', key:'N', openWith:"[table][tr][td]", closeWith:"[/tr][/td][/table]"},
    

    Before this

    {name:'Preview', key:"P", call:'preview', className:'preview'}
    

    I think that about covers it!

     
  • Peter
    Peter
    2012-07-31

    Just to add…. the above has only added < table ><tr> <td> tags, any other needed, you can add yourself, should be self explanatory. I didn't add these buttons to the editor, I personally didnt need it.