[IPython-dev] CodeMirror overlay for spell checking
Simon Cropper
simoncropper at fossworkflowguides.com
Thu Jul 24 22:08:27 EDT 2014
> 1) Should markdown cells be the only cells spell checked?
Yes
> 2) doesn't currently allow for right-click suggestion fixes; important?
I think this is important. It wastes time if you need to consult and
third-party resource to clarify the spelling.
> 3) English only. Just need to provide more dictionaries and an API to
> change the dictionary.
In most dictionaries variants of English dictionaries exist --
English-UK, English-USA, English-Australian... Access to these would be
good. Alternatively documenting how people could create appropriate
dictionaries would be satisfactory.
> 4) Should the spell checking be on all of the time?
I think a preference that allowed the spelling to be turned on and off
would be good.
On 25/07/14 11:59, Doug Blank wrote:
> Success; we now have a working IPython notebook with spelling checking
> in Markdown cells!
>
> I'll try to package this up over the next few days to make a notebook
> extension for all kernels. Currently, I have this all in one custom.js
> file [1] ... check out the toggle_spell_check function and code loaded
> on app_initialized.
>
> The way that is currently works is as a toggle "spell check" button:
> click it once, and it turns on a spell check overlay over the "markdown"
> mode on all Markdown cells (see attached picture). Press the button
> again, and it turns it off.
>
> I'm currently using Typo.js, but any JavaScript spell check library
> could work. Typo isn't bad... may need to adjust what gets checked (need
> to remove single quotes, and maybe add HTML tag names to dictionary).
>
> Possible options/limitations:
>
> 1) Should markdown cells be the only cells spell checked?
>
> 2) doesn't currently allow for right-click suggestion fixes; important?
>
> 3) English only. Just need to provide more dictionaries and an API to
> change the dictionary.
>
> 4) Should the spell checking be on all of the time?
>
> Other options/suggestions welcomed!
>
> -Doug
>
> [1] -
> https://bitbucket.org/ipre/calico/src/master/notebooks/profile/static/custom/custom.js
>
> This custom.js has a few things in it that we'll break into extensions:
> two-column mode, bibtex references, tabbed in/out cells, heading
> numbering, table of contents, and spelling checking.
>
>
>
> On Thu, Jul 24, 2014 at 4:52 PM, Doug Blank <doug.blank at gmail.com
> <mailto:doug.blank at gmail.com>> wrote:
>
> On Thu, Jul 24, 2014 at 2:31 PM, Damián Avila <damianavila at gmail.com
> <mailto:damianavila at gmail.com>> wrote:
>
> > I'm interested to see the code.
>
> Me too ;-)
>
>
> Thanks for the hints and links...
>
> Oh, we'll make this available to all... no more misspellings in
> notebooks!
>
> -Doug
>
>
>
> 2014-07-24 15:30 GMT-03:00 Matthias Bussonnier
> <bussonniermatthias at gmail.com
> <mailto:bussonniermatthias at gmail.com>>:
>
>
> Le 24 juil. 2014 à 19:06, Doug Blank a écrit :
>
> > I have successfully created and registered a CodeMirror
> overlay (for spell checking), but two questions:
> >
> > 1) Which of the modes is used for Markdown cells? I guess
> that will be the mode that I overlay.
>
> JSconsole :
>
> > IPython.TextCell.options_default.cm_config.mode
> "htmlmixed"
>
>
>
> >
> > 2) How do I make it so that my new mode will be used on
> Markdown cells?
>
> IPython.TextCell.options_default.cm_config.mode = yourmode
> +
> loop on all cell and set
> IPython.notebook.get_cell(0).code_mirror.setOption('mode',yourmode)
>
> might need to require your mode first though, maybe with
> code_mirrorm.getMode
>
> cf julia custom.js
>
> https://github.com/JuliaLang/IJulia.jl/blob/master/deps/custom.js#L66-L90
>
> >
> > I guess that I need to associate the mime type of
> Markdown cells with my new mode, but having some trouble
> finding where to connect this in the IPython JavaScript.
>
> I'm interested to see the code.
> --
> M
>
> >
> > Thanks for any suggestions,
> >
> > -Doug
> >
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev at scipy.org <mailto:IPython-dev at scipy.org>
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org <mailto:IPython-dev at scipy.org>
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
>
> --
> */Damián/*
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org <mailto:IPython-dev at scipy.org>
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
--
Cheers Simon
Simon Cropper - Open Content Creator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction http://www.fossworkflowguides.com
GIS Packages http://www.fossworkflowguides.com/gis
bash / Python http://www.fossworkflowguides.com/scripting
More information about the IPython-dev
mailing list