Giter VIP home page Giter VIP logo

Comments (5)

juhasch avatar juhasch commented on July 26, 2024

This extension is outdated. Thanks for bringing this up.
Try adding this to you custom.js file:

var add_edit_shortcuts = {
        'Alt-c' : {
            help    : 'toggle comments',
            help_index : 'eb',
            handler : function (event) {
                var cm=IPython.notebook.get_selected_cell().code_mirror
                var from = cm.getCursor("start"), to = cm.getCursor("end");
                cm.uncomment(from, to) || cm.lineComment(from, to);
                return false;
            }
        },
};
IPython.keyboard_manager.edit_shortcuts.add_shortcuts(add_edit_shortcuts);

from jupyter_contrib_nbextensions.

jorgesca avatar jorgesca commented on July 26, 2024

Thanks for looking this up. I tried your suggestion, but I stll get errors on the console:

Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead jquery.min.js:1
TypeError: IPython.keyboard_manager is undefined custom.js:123
"Default extension for cell metadata editing loaded." default.js:48
"Raw Cell Format toolbar preset loaded." rawcell.js:82
"Slideshow extension for metadata editing loaded." slideshow.js:43
"Session: kernel_created (9fe531c4-50d8-4cb3-943a-e085be4ff18a)" session.js:52
"Starting WebSockets:" "ws://localhost:8888/api/kernels/88c3ab91-e1d0-4655-b1a9-4a7aa7e3e93d" kernel.js:440
"Loaded extension: usability/codefolding/codefolding" utils.js:26
TypeError: string is undefined codemirror.js:7300
Use of getPreventDefault() is deprecated.  Use defaultPrevented instead. jquery.min.js:5
"Kernel: kernel_connected (88c3ab91-e1d0-4655-b1a9-4a7aa7e3e93d)" kernel.js:102
"Kernel: kernel_starting (88c3ab91-e1d0-4655-b1a9-4a7aa7e3e93d)" kernel.js:102
"Kernel: kernel_ready (88c3ab91-e1d0-4655-b1a9-4a7aa7e3e93d)" kernel.js:102

from jupyter_contrib_nbextensions.

juhasch avatar juhasch commented on July 26, 2024

From your console output, this looks might be related to something else.
Ttry executing the above lines in a notebook cell using:

%%javascript
...

This will execute the cell as javascript code.

from jupyter_contrib_nbextensions.

jorgesca avatar jorgesca commented on July 26, 2024

You're right, it works when executed from a cell. That's something! At least I can enable commenting and uncommenting from within a notebook until I find out what's wrong. Maybe in one of the previous attempts I left something...
Thanks again!

from jupyter_contrib_nbextensions.

jorgesca avatar jorgesca commented on July 26, 2024

I re-created my profile, added the javascript code you posted above to custom.js, and now it's working. One thing, I think, that was getting in the way from the beginning was the IPython's security feature for the notebook. Unless I did something stupid when I checked this, it is only after trusting the notebook I am using that the comment shorcut starts working. I guess I can close this issue now. Thanks for your help

from jupyter_contrib_nbextensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.