patbenatar / crevasse

A split-screen Markdown editor and previewer
http://patbenatar.github.com/crevasse
47 stars 6 forks source link

Code Block syntax highlighting #11

Open radaniba opened 11 years ago

radaniba commented 11 years ago

The syntax highlighting is working on Firefox, Chrome, but not on Safari. Did not test yet on IE

Thanks

UPDATE : Apologize, actually Safari works fine as well but we need to make a line return for it to work

patbenatar commented 11 years ago

@biocodershub Thanks for reporting this odd behavior.. Can you send me the example Markdown doc that was failing to highlight in Safari?

radaniba commented 11 years ago

actually when you embed a code block, the highlighting comes and goes when you add a text after or even if you add/remove \n after the closing ``` Try add this code :

def check_path():
    """
    make sure the libsvm stuff is on the path
    """
    paths = (op.abspath(p) for p in os.environ['PATH'].split(":"))
    for p in paths:
        if op.exists(op.join(p, "/home/Utilities/libsvm-master/svm-train")): return True
    for path in ("../", "./"):
        if op.exists(path + "/home/Utilities/libsvm-master/svm-train"):
            os.environ['PATH'] += ":" + path
            return True

    print >>sys.stderr, "\n** /home//Utilities/libsvm-master/svm-train not found in path **\n" + ("*" * 80)

    return False

and then write (add) text and look at the highlighting while you write, you will see that the highlighting appears and disappears randomly

It is actually a behaviour in all the browsers

patbenatar commented 11 years ago

@biocodershub Yikes! Thanks for the report, I'll look into it when I have a minute.

radaniba commented 11 years ago

You're welcome ! It is one of best editors I've seen till now, simple, elegant and fits perfectly to my needs. The only thing I am not able to figure out yet is adding tables, I tired all the markdown for tables, no one seems to be successfully parsed correctly, do you have a sample markdown for tables ?

Thanks again

patbenatar commented 11 years ago

Happy to hear it—simple and elegant were my two primary goals when creating Crevasse!

It should be possible to use tables as our markdown parser (Marked.js) supports them according to their docs.. Is this the syntax you're trying to use: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#wiki-tables

radaniba commented 11 years ago

Yes, I tried the syntax in this url, it is not working.

| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
patbenatar commented 11 years ago

K I'll take a look

radaniba commented 11 years ago

For the code highlight, there is another bug when you reload the page with a code block, look at the figure below

bug

You must click on the markdown and type some text so that it re-render the code block again

patbenatar commented 11 years ago

@biocodershub Yikes! Thanks for the report. I'll take a look when I have some time. Feel free to send a PR if you are able to isolate the problem code. :beers: