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

Jupyter does not work with Grammerly #5123

Closed
jeffheaton opened this issue Dec 19, 2019 · 15 comments
Closed

Jupyter does not work with Grammerly #5123

jeffheaton opened this issue Dec 19, 2019 · 15 comments

Comments

@jeffheaton
Copy link

jeffheaton commented Dec 19, 2019

I've been using www.grammarly.com, which is a popular spelling and grammar checker. It would be really nice if Jupyter supported this in the markdown cells. In this case, I am using the Grammarly Chrome extension. It works in nearly any web input box I've worked with, even the GitHub issue editor that I am using to type this.

Not sure what you want more in the way of details. Installing the free version of Grammarly and attempting to use it on a markdown editor will show this problem.

@aishrock006
Copy link

Not sure for Grammar checker but for spell checker you could enable spellchecker from Nbextensions.
You can find the blog to enable spellchecker from this site:

http://qingkaikong.blogspot.com/2018/09/spell-checking-in-jupyter-notebook.html

@jeffheaton
Copy link
Author

@aishrock006 Yes I know about that.

@dniku
Copy link

dniku commented May 2, 2020

The spellchecker available as an nbextension is too bare-bones compared to Grammarly. Although I'm not sure the problem of incompatibility should be solved by Jupyter rather than by Grammarly.

@AnirudhDagar
Copy link

Adding Grammarly to Jupiter will be very helpful.

@an5ir
Copy link

an5ir commented Oct 14, 2020

Hi, is there any further update on this?

@kevin-bates
Copy link
Member

@an5ir - no update. I agree this would be a nice feature, but it will likely need to be contributed by the community due to a lack of active maintainers. I would also recommend focusing this effort in JupyterLab - which will also provide better development support.

@jeffheaton
Copy link
Author

jeffheaton commented Oct 15, 2020

Most apps support Grammarly out of the box. Probably it is good to look at what in the Jupyter notebook is non-standard in a way that breaks Grammarly. The root cause probably has other issues as well. Even this comment that I am now typing into GitHub is working just fine in Grammarly. It is usually not an issue.

@scotgopal
Copy link

Looking forward to this issue to get addressed. Having Grammarly support for Jupyter will definitely be a life-saver especially for teaching material development! 🙏

@richard-herron
Copy link

richard-herron commented Mar 24, 2021

LanguageTool has a plugin that approximates a solution, albeit with LanguageTool instead of Grammarly. You can select all text in a markdown cell, then right click and send it to LanguageTool. You have to copy-and-paste to get edited text back to Jupyter Notebook, but I find this easier than exporting to HTML, opening in Word, then updating my markdown cell to match the Grammarly feedback in Word.

@brucefwu
Copy link

I did some investigating and have a good idea of what's going on. Here are some facts about Grammarly's functionality:

  • It automatically targets <textarea> tags on a website.
  • It provides specialized support for popular web apps such as Google Docs.
  • It ignores any text contained in <pre> tags and several other tags. <pre> stands for preformatted text and is a popular method for displaying code on a website. Below is the relevant line in Grammarly's source code:
    l.ignoredTags = new Set(["PRE", "CODE", "BLOCKQUOTE", "STYLE", "SCRIPT", "NOSCRIPT", "IMG", "SVG", "CANVAS", "AUDIO", "VIDEO", "IFRAME", "EMBED", "OBJECT", "BUTTON"])

As a result:

  • The comment box on this issues page is a <textarea> tag. Therefore Grammarly works here.
  • Markdown cells in Jupyter notebooks are wrapped in <pre> tags while being edited, and there's no <textarea>. Therefore Grammarly does not work there.
  • The behaviour is interesting while editing Markdowns on GitHub, such as a README. The editor is wrapped in a <textarea>, so the Grammarly button appears. However, all the code are wrapped in <pre> tags, so it sees no text to analyze and the button isn't clickable.

Unfortunately, I think the only way we can resolve this issue is to ask Grammarly to specifically support Jupyter.

@kevin-bates
Copy link
Member

Hi @brucefwu - this is excellent information, thank you!

Do you happen to know how to go about asking Grammarly to add support and what kind of information they might need?
Since, to the best of my knowledge, the frontends between Notebook and JupyterLab are quite different, I wonder if it might be more worthwhile to focus on this from the perspective of Lab.

@brucefwu
Copy link

brucefwu commented Apr 13, 2021

You can send Grammarly feedback through this form: https://www.grammarly.com/extension-uninstall

One of the options is it "doesn't work on my favorite websites". If enough people mention Jupyter (and perhaps Markdown editors in general), it might get their attention.

In JupyterLab 2.2.6 I can select the Markdown cell currently being edited using document.querySelector(".jp-MarkdownCell.jp-mod-selected"), and the text within can be accessed by appending .innerText. This info might be helpful for their team.

@jsulopzs
Copy link

Yessss! Everyone that got into these posts should go to the form https://www.grammarly.com/extension-uninstall and follow the steps that @brucefwu said to lobby the upgrading for Grammarly to work appropriately on Jupyter Lab.

@arash-mc
Copy link

arash-mc commented Jan 10, 2022

I do this to get Grammarly work on the jupyter lab markdown cell. I put everything between <textarea> </textarea> tags and after doing the revisions, I comment out the tags

@tonyfast
Copy link
Collaborator

This is solved in JupyterLab by upgrading to CodeMirror 6 and will be solved in the future Notebook v7 release.

For more information about this new release, checkout the Notebook v7 Enhancement Proposal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests