Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Syntax Highlighting (take 2) #379

Merged
merged 8 commits into from Mar 19, 2015
Merged

Conversation

felixcheung
Copy link
Contributor

#300 - continuing from where we left off. I ran into some very bad error with js and couldn't figure out how to make it not error out, so I finally gave up I started clean in a new branch.

This PR includes Markdown code block syntax highlighting and Ace Editor theme setting, as an example. It only set 1 theme (matching for now) for each.

Also detailing in documentation what's required if someone wants to change it.

Here's what it looks like:
image

And here's 'what-if' if we are to change theme for the editor (but not markdown) This is not checked in. To be clear, no way to use this theme without changing code/build)
image

Feedback appreciated.

- porting markdown interpreter error handling
- call highlight.js for markdown pre code blocks
- call ace editor setTheme
- add highlight.js to bower and override to add selected style + style/theme for ace
@felixcheung
Copy link
Contributor Author

@swkimme
Copy link
Contributor

swkimme commented Mar 12, 2015

Reviewed, much shorter and cleaner codes than before! Great!!
Let me give some time to test this PR.
Great job!

@Leemoonsoo
Copy link
Contributor

While testing, i've found one problem with block selection in code editor.
image

@felixcheung
Copy link
Contributor Author

Thanks, I noticed that too when I switched to a different editor theme, didn't realize it was happening somewhere else.
A stylesheet is overriding the foreground color it seems. Let me investigate.

@swkimme
Copy link
Contributor

swkimme commented Mar 13, 2015

Adding transparent background to hljs class would be cooler.
screen shot 2015-03-13 at 2 11 56 pm
screen shot 2015-03-13 at 2 12 06 pm

@felixcheung
Copy link
Contributor Author

Something is overriding the selection but it's not

app/style/notebook.css

.ace-tm .ace_marker-layer .ace_selection {
    background: rgba(98, 157, 233, 0.2) !important;
    color: black;
}

.ace_active-line {
    background: rgba(98, 157, 233, 0.2) !important;
}

.ace-tm .ace_marker-layer .ace_selected-word {
    background: rgba(250, 250, 255, 0.2) !important;
}

any idea?

@felixcheung
Copy link
Contributor Author

Fixed editor selection color issue.
@swkimme +1 for gray though :)

@felixcheung
Copy link
Contributor Author

Any more thoughts or comments?

@Leemoonsoo
Copy link
Contributor

I still have selection problem, am i missing something?

…x: auto in notebook.css

Also remove unneeded background color since they are now the same as the github theme
@felixcheung
Copy link
Contributor Author

@Leemoonsoo Sorry about that, I must have been messing it too much in the browser dev tool. That was only a partial fix.

Here's what it looks like now:
image

And there has been a similar issue with word selection and it is also fixed:
image

@Leemoonsoo
Copy link
Contributor

Selection now works well!

There is a box in a code block and have slightly different background color, ie
image
Will this PR handle the issue, too?

@felixcheung
Copy link
Contributor Author

@Leemoonsoo Good point. This was also pointed out in PR #300. Since we bring in both bootstrap and highlight.js with bower, I'm not sure which is the best option to address this:

  1. Override markdown code block box background in app/style/notebook.css
  2. Fork/create a new stylesheet file and change code block style background in the css

Option 1 is rather hard to discover for a new comer (me?) to find all those overrides....

Also, we have options on the color to change it to:
a. #f5f5f5
b. transparent (therefore just as before, as suggested by @swkimme)

Could we merge this for now and I'll follow up with another PR?

@anthonycorbacho
Copy link
Contributor

why another PR?
this is the perfect PR for fixing the issue.

@corneadoug
Copy link
Contributor

I wanted to just push the CSS fix, but it means I would nee to fork @felixcheung Zeppelin fork, then do a pull request on his fork.....

So, since there is no theme switch for hightlight.js, and we don't handle css theme change, we can just add the fix to notebook.css.

.paragraph .tableDisplay .hljs {
  background: none;
}

.paragraph .ace_print-margin {
  background: none !important;
}

This also fix an annoying margin border on Ace editor

Before
screen shot 2015-03-17 at 11 29 38 am

After
screen shot 2015-03-17 at 11 40 42 am

@swkimme
Copy link
Contributor

swkimme commented Mar 17, 2015

+1 for @corneadoug 's solution

1 similar comment
@Leemoonsoo
Copy link
Contributor

+1 for @corneadoug 's solution

…editor.setShowPrintMargin(false) does not work - it will collapse the entire editor)
@felixcheung
Copy link
Contributor Author

Updated.

@Leemoonsoo
Copy link
Contributor

Tested and Looks good to me

@Leemoonsoo
Copy link
Contributor

I added this PR to https://github.com/NFLabs/zeppelin/issues/383.
I'm merging it if there're no more discussions!

@Leemoonsoo
Copy link
Contributor

@felixcheung Thanks for contribution! awesome job!

Leemoonsoo added a commit that referenced this pull request Mar 19, 2015
Code Syntax Highlighting (take 2)
@Leemoonsoo Leemoonsoo merged commit d5236b8 into ZEPL:master Mar 19, 2015
@felixcheung
Copy link
Contributor Author

Very Nice! Thanks

@swkimme
Copy link
Contributor

swkimme commented Mar 19, 2015

Great job!

On 2015년 3월 19일 (목) 12:53 Felix Cheung notifications@github.com wrote:

Very Nice! Thanks


Reply to this email directly or view it on GitHub
#379 (comment).

epahomov pushed a commit to epahomov/zeppelin that referenced this pull request Jul 23, 2016
Hot fix for https://issues.apache.org/jira/browse/ZEPPELIN-375, until we get better resolution.
This patch moves geode from default build to profile.

Author: Lee moon soo <moon@apache.org>

Closes ZEPL#379 from Leemoonsoo/ZEPPELIN-375-hotfix and squashes the following commits:

7740296 [Lee moon soo] Hotfix for ZEPPELIN-375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants