Getting only selected/marked text/code from a cell possible?

I have a simple extension that get the complete content of a selected markdown cell.

Is it possible to get/extract only the parts in a markdown or code cell that are selected/marked?

Yes. I recall jupyter-ai does this here:

Also, core JupyterLab search extracts selection when populating search box on Ctrl + F, the diff of this PR will show you two ways to do that: Uses the browser window's selection as the default search query by JasonWeill · Pull Request #15834 · jupyterlab/jupyterlab · GitHub

2 Likes

Cool, thanks so much! I simply couldn’t find my way through the docs to solve this.

1 Like