Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
markdowku --- new types of code blocks?
new types of code blocks?
Avatar
iaw4 #1
Member since Dec 2017 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: markdowku --- new types of code blocks?
I am a happy end user of markdowku.  however, I now have a problem of how I could program in a small new feature.

I am looking at thecode at .../lib/plugins/markdowku/syntax/githubcodeblocks.php .  I am trying to figure out how to add my own "type" of code blocks.  say

```economics

demand == supply

```

at the very least, I want the `economics` to be ignored.  at best, I would like to understand how to format the content inside the ``` codeblock, such as boldfacing the "==".  the easiest would of course be using an external language->html converter.

I need to locate some example code that already does this.  the ```php type code block does some nice formatting.

could someone please tell me where to find this?
Avatar
LarsDW223 #2
Member since Sep 2014 · 448 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Syntax highlighting in DokuWiki is done using the GeShi project, see folder vendor/easybook/geshi and the website http://qbnz.com/highlighter/.
Avatar
iaw4 #3
Member since Dec 2017 · 10 posts
Group memberships: Members
Show profile · Link to this post
mille grazie.  I think the relevant language definition files sit in `.../vendor/easybook/geshi/geshi/`.

alas, I just tried removing all the language files to see whether it makes a difference, and it does not.  I also grepped for geshi in /lib/plugins.  nothing.  how does it get picked up into markdowku?
Avatar
LarsDW223 #4
Member since Sep 2014 · 448 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Did you try to clear the cache, e.g. by appending &purge=true to the URL? Code blocks are cached so they usually are only rendered new if their content changes.
Avatar
iaw4 #5
Member since Dec 2017 · 10 posts
Group memberships: Members
Show profile · Link to this post
I believe so.

even more extreme, I tinkered with `/inc/parserutils.php`.  I can put a string into the highlighted code and turn off all caching and see that the result shows up.

I could then figure out to make sure everything got picked up.  the markdown codeblock keyword seems to be determined by the filename, not by anything in the file.  All good now.  Thank you for the help.

/iaw

PS: for some reason, a hyphen is not allowed in the filename / markdown keyword
Avatar
iaw4 #6
Member since Dec 2017 · 10 posts
Group memberships: Members
Show profile · Link to this post
oh, and the style file seems to be `/lib/styles/geshi.less`.

alas, what is really weird, in the julia geshi file I picked up, I know the geshi file is used to render my page.  (I can remove a keyword, look at the result, and confirm it.)  however, my attempt to play with the STYLES KEYWORDS file seem to be completely ignored.  it just uses the definitions in /lib/styles/geshi.less , instead of the ones in my julia.php file.  any idea?


```
$language_data = array (
    'LANG_NAME' => 'Julia',
    'COMMENT_SINGLE' => array(1 => '#'),
    'COMMENT_MULTI' => array(),
    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    //Longest quotemarks ALWAYS first
    'QUOTEMARKS' => array('"""', '"', "'"),
    'ESCAPE_CHAR' => '\\',
    'KEYWORDS' => array(

        /*
        ** reserved words
        */
        1 => array(
        'function', 'global', 'for', 'end', 'while', 'if', 'else', 'elseif', 'break',
        'switch', 'case', 'otherwise', 'try', 'catch', 'const', 'immutable',
        'import', 'importall', 'export', 'type', 'typealias', 'return', 'true',
        'false', 'macro', 'quote', 'in', 'abstract', 'module', 'using', 'continue',
        'ifelse', 'do', 'eval', 'let', 'finally', 'throw'
            ),

        /*
        ** builtins
        */
        2 => array(
        'Array', 'String', 'Bool', 'Number', 'Int', 'Integer', 'Real', 'Complex',
        'FloatingPoint', 'Float64', 'Float32', 'Int8', 'Int16', 'Int32', 'Int64',
        'Rational', 'AbstractArray', 'Unsigned', 'Signed', 'Uint', 'Uint8', 'Uint16',
        'Uint32', 'Uint64', 'Vector', 'AbstractVector', 'Matrix', 'AbstractMatrix',
        'Type', 'IO', 'Any', 'ASCIIString', 'Union', 'Dict', 'Function', 'SubArray',
        'Range', 'Range1', 'Symbol', 'Expr',

        'cell', 'collect', 'filter', 'merge', 'divrem', 'hex', 'dec', 'oct', 'base',
        'int', 'round', 'cmp', 'float', 'linspace', 'fill',    'start', 'done', 'tuple',
        'minimum', 'maximum', 'count', 'index', 'append', 'push', 'pop', 'shift',
        'unshift', 'insert', 'splice', 'reverse', 'sort', 'zip', 'length', 'delete',
        'copy', 'haskey', 'keys', 'values', 'get', 'getkey', 'Set', 'isa', 'issubset',
        'intersect', 'setdiff', 'symdiff', 'complement', 'print', 'printf', 'println',
        'sprintf', 'utf8', 'char', 'search', 'rsearch',
        'replace', 'lowercase', 'uppercase', 'ucfirst', 'lcfirst', 'union',
        'split', 'rsplit', 'chop', 'chomp', 'lpad', 'rpad', 'lstrip', 'rstrip',
        'strip', 'isalnum', 'isalpha', 'isascii', 'isblank', 'iscntrl', 'isdigit',
        'isgraph', 'islower', 'isprint', 'ispunct', 'isspace', 'isupper', 'isxdigit',
        'match', 'captures', 'offset', 'offsets', 'matchall', 'eachmatch', 'hcat',
        'vcat', 'hvcat', 'reshape', 'deepcopy', 'similar', 'reinterpret', 'map',
        'reduce', 'mapreduce', 'DataArray', 'DataFrame', 'removeNA', 'replaceNA',
        'colnames', 'head', 'tail', 'describe', 'join', 'groupby', 'by', 'stack',
        'readtable', 'readcsv', 'readdlm', 'writetable', 'writecsv', 'writedlm',
        'require', 'reload', 'include', 'evalfile', 'cd', 'open', 'write', 'close',
        'position', 'seek', 'seekstart', 'skip', 'isopen', 'eof',
        'isreadonly', 'ltoh', 'htol', 'serialize', 'deserialize', 'download',
        'isequal', 'getindex', 'setindex', 'eachline', 'beginswith', 'endswith',
        'parsefloat', 'parseint', 'seekend', 'findnz', 'DivideError', 'addprocs',
        'scale', 'issubnormal', 'readdir', 'mapslices'
            ),

        /*
        ** system interaction
        */
        3 => array(
        'run', 'spawn', 'success', 'process_running', 'process_exited', 'kill',
        'readsfrom', 'writesto', 'readsandwrite', 'detach', 'setenv', 'ENV', 'getpid',
        'clipboard', 'strftime', 'time', 'gethostname', 'getipaddr', 'pwd',
        'mkdir', 'mkpath', 'rmdir', 'ignorestatus'
            ),

        /*
        ** prompt
        */
        4 => array(
        'julia>'
            )
        ),
    'SYMBOLS' => array(
            '(', ')', '[', ']', '{', '}', '*', '&', '|', '%', '!', ';', '<', '>', '?', '`'
        ),
    'CASE_SENSITIVE' => array(
        GESHI_COMMENTS => false,
        1 => true,
        2 => true,
        3 => true,
        4 => true
        ),
    'STYLES' => array(
        'KEYWORDS' => array(
            1 => 'color: #000000;font-weight:bold;',    // Reserved #4266d5
            2 => 'color: #0000A8;font-style:italic;',    // Built-ins
            3 => 'color: #0000A8;font-style:italic;',    // System Interaction
            4 => 'color: yellow;font-weight:bold;'     // Prompt or #89e234
            ),
        'COMMENTS' => array(
            1 => 'color: #888888;',
            'MULTI' => 'color: #888888;'
            ),
        'ESCAPE_CHAR' => array(
            0 => 'color: #000099; font-weight: bold;'
            ),
        'BRACKETS' => array(
            0 => 'color: #3b972e;font-weight:bold'
            ),
        'STRINGS' => array(
            0 => 'color: #c93d39;'
            ),
        'NUMBERS' => array(
            0 => 'color: black;'
            ),
        'METHODS' => array(
            1 => 'color: black;'
            ),
        'SYMBOLS' => array(
            0 => 'color: #6bab5b;'
            ),
        'REGEXPS' => array(
            ),
        'SCRIPT' => array(
            )
        ),
    'URLS' => array(
        1 => '',
        2 => '',
        3 => '',
        4 => ''
        ),
    'OOLANG' => true,
    'OBJECT_SPLITTERS' => array(
        1 => '.'
        ),
    'REGEXPS' => array(
        ),
    'STRICT_MODE_APPLIES' => GESHI_NEVER,
    'SCRIPT_DELIMITERS' => array(
        ),
    'HIGHLIGHT_STRICT_BLOCK' => array(
        )
);

?>
```
Avatar
LarsDW223 #7
Member since Sep 2014 · 448 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
I never digged deeper into the Geshi code. Maybe you better search for help/documentation on the Geshi project page.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-12-06, 09:01:54 (UTC +01:00)