Preventing markdown cells from un-rendering (Jupyter): showEditorForReadOnlyMarkdow - jupyter-notebook

following this post and the issues tab regarding this problem I have found that to make a cell that is set to "editable":false not be able to be un-rendered I need to set showEditorForReadOnlyMarkdown to false.
It is not clear to me how to actualy do this, and how to make it permanant.
This is what I have tried so far:
I have found that throught Jupyter-Lab I can go to settings->advanced settings editor->JSON Settings Editor and change this setting, but the change is permanant only for My Jupyter-Lab environment -- opening up the notebook elsewhere will not save this setting.
Setting "showEditorForReadOnlyMarkdown":false in the cell or notebook metadata via a local jupyter notebook doesnt do anything.
Ultimatley, as the notebooks I am making are for learning purposes, I would like all cells that are uneditable to be permanantly rendered as to minimize issues and/or confusion.
Any help will be appreciated. Thank you.

For any others looking for the currently available per-Jupyter-lab setting that Iddo mentions above, to do it through the GUI it's "Settings" -> "JSON Settings Editor" (icon at top-right of initial Settings tab), then it's found in "Notebook" near the bottom (this is in JupyterLab 3.6.0). I couldn't edit it in place, not sure if that was just me, but could add to the User Preferences box on the right, e.g.:
{
"showEditorForReadOnlyMarkdown" : false
}
One way it can be done programmatically is by creating/modifying this overrides json file to hold:
{
"#jupyterlab/notebook-extension:tracker": {
"showEditorForReadOnlyMarkdown" : false
}
}
(This not an answer to the question, but I can't "comment" due to not having enough reputation points, so had to put this here as an "Answer" ¯\_(ツ)_/¯)

Related

How to collapse a Java code cell (made in Jupyter Notebook) on a website with Jekyll blog posts?

I have a blogging website using fastpages, which allows me to create Jekyll posts, along with posts created with Jupyter Notebook.
I'm creating a Jupyter Notebook post in VS Code that is using the Java kernel and want to hide a Java code cell.
The fastpages README says that you can hide a code cell with #collapse at the top of the code cell, while its blog website says that you can use #collapse-hide.
I tried both of these options on my code cell, but when I run them, it says illegal character: '#'
I think the issue might be that #collapse-hide might only work for Python cells, but I'm pretty lost when searching for the problem.
The Jupyter Notebook documentation says that you can hide code cells with
{
"tags": [
"hide-input",
]
}
but I do not know where to put this metadata in.
On that page, there is also a link to a cell tags guide. I tried Step 1 (by clicking View -> Cell Toolbar -> Tags), but after clicking the Tabs button, I do not know what to do. I also tried going to View -> Cell Toolbar -> Edit Metadata, but when I paste the metadata above, it says Could not save invalid JSON
(by the way, I am using Jupyter Notebook on my localhost now, not VS Code)
I tried removing the curly braces from the metadata (because I think the curly braces would be for if I only paste the metadata and there isn't the other stuff (like "vscode": {...?), but the same error occurs.
I don't know how to code in JSON, I would just like to be able to hide my code cell on my website, like this:
I do not even know if I am heading in the right direction. Basically, I would like to know: how can I hide my Java code cell?

How to set color of cell output of jupyter notebook (.ipynb) in VS Code editor?

Sometimes it is convenient to deal with jupyter notebooks from the VS Code editor (faster load, less latency and easier debugging).
Nonetheless, there is a problem that default theme colors are not contrast enough to distinguish between input and output cells.
I'm having a hard time to figure out which setting I should change, to, let us say, make the output cell background just "dark-grey" (I'm using default VS 2019 Dark theme but other options are also not contrast with .ipynb files).
Any help will be welcome.
(I've also come across other similar questions but did not find the turn key solution.)
Example:
In the settings.json -- can be found at File(Windows)/Code(Mac)>Preferences>Settings -- click on any link stated "Edit in settings.json"
Adding this into the json will work -- notebook's setting has to be put under the workbench.colorCustomizations.
"workbench.colorCustomizations": {
"notebook.outputContainerBackgroundColor": "#FFFFFF",
},
I'm not sure if this helps you, but you can try overriding VSCode's theme by adding this to your settings.json file:
{
"jupyter.ignoreVscodeTheme": true
}
If you prefer to use VSCode's gui to edit settings, you can go to your Jupyter extension (assuming you have it installed) => Extension settings => and check "Ignore Vscode Theme".
You need to restart or reload VSCode for this to take effect.

Atom.io find in project not working

I am trying to use the "find in project" feature of Atom editor.
I am coming from sublime and assumed that opening a folder is the equivalent of opening a project. Is this assumption correct?
If so, then I have a project open. I then search from a string using "Find in project". I am certain the string exists, and the file type is not ignored, yet it still returns no result.
I ran into this issue, and it only affected one project - a project in a git repo.
I checked the settings of the search field.. they were fine.
My issue was, as #fab313 mentioned above, as the setting in Core > Exclude VCS ignored paths.
Once I unchecked that box (Atom menu, Preferences, Core).. all project searches worked fine!
I had this same problem and I found that I accidentally clicked some of the settings boxes in the bottom right.
You just want to make sure you know which boxes are checked.
If I check one of those boxes (making them blue) then my CTRL/Command + F will only find a single result.
The settings will look like this and cause the problems for me:

Brackets - unable to edit defaultPreferences.json file (trying to set linting to jshint but not jslint)

I am running Brackets on a macbook pro and when I press cmd+, and try to edit the defaultPreferences.json file, it does not allow me to make any changes to the file (nothing happens when I type). If I restart Brackets I can edit the file, but after closing and re-opening the preferences file, the changes are reverted.
I have tried editing the json file with TextEdit while Brackets is closed, but Brackets still likes to reverse the changes.
I had similar issue , and i did open issue at Bracket's GitHub repository and here is the solution from its developers:-
defaultPreferences.json is a read-only file: take the options you
want to modify and copy them to the brackets.json file on the other
pane. This will override the defaults. You will also see code hints
while typing the values in to brackets.json which will help picking
the correct options.
Now it is also available to install brackets-preferences plugin and edit from there. Once installed go to View -> Preferences in your Brackets interface to edit preferences.

How to bookmark code in XCode 4?

I couldn't find a way to put a bookmark inside the code in XCode 4. I know about the #pragma mark thing but it's not what I'm looking for. What I need is something that I can put and remove with a mouse click and navigate amongst with next and previous, like in VS.
Is there anything that I'm missing?
Bookmarks seem to have gone the way of the dinosaur in Xcode 4. This wouldn't have been so bad had the jump-to-bookmark popup above the editor in previous versions not also disappeared. The best replacement currently seems to be to use breakpoints (disabled individually, of course) and navigate with the Breakpoint Navigator.
Shortcut to breakpoints is Cmd + 8. Once there use arrow keys
File a bug report at http://bugreporter.apple.com if you feel something like this should be brought back.
Write below comment in your source file that you want bookmarked.
//<##>
And you can navigate to next / previous with: '^/' or '^?'
<##> means "placeholder of code snippet"
^/ means "jump to next placeholder"
^? means "jump to previous placeholder"
thanks
Another option, if anyone is still interested. The following directives will both produce a compiler warning that you can use as a bookmark:
#pragma message "<# message #>"
or
#warning <# message #>
If you want to place bookmarks using your mouse: create a code snippet with one of the 2 directives above. Drag & drop it to the line in your source file that you want bookmarked.
Navigate to next/previous with: Cmd-' and Cmd-Shift-'
In Xcode 4.4, if you leave a comment with this format:
// TODO: Your text here
it will be added as a listing in the jump bar alongside the list of methods in your current file, and then you can jump straight to that comment from that menu.
The simplest technique is to use a comment prepended by // TODO and then search, which allows you to jump through the issues from the navigator. Pretty hard to beat that technique.
I personally don't like using break points for bookmarks because it is not easy to enter notes. I use breakpoints as breakpoints, and prefer not to mix them up with bookmarks.
Anyhow, if you want to get a bit fancier you could get xcode to generate warnings // TODO: some message or // FIXME: some message that can be navigated in the issue navigator. I took the instructions below from this site:
Instructions
Head over to your project's item in the Project Navigator (usually at the very top)
Find your target in the list of targets on the left, select it
Head over to the "Build Phases" tab.
Click the "Add Build Phase" in the bottom right of this screen.
In the editor that appears insert the bash script shown below.
Now just build and you'll see all your //TODO: and //FIXME: comments have become warnings. I love this technique, it might not be right for everyone, but hope it helps someone.
Bash Script For "Run Script" Build Phase
KEYWORDS="TODO:|FIXME:|\?\?\?:|!!!:"
find "${SRCROOT}" ( -name ".h" -or -name ".m" ) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
You'll also be able to click on each of the warnings in the issue navigator to go right to the file and point in your code where you left the original //TODO: or //FIXME:
Extra pro tip: Make sure you're using phrases to describe your //TODO: comments like //TODO: Handle this error gracefully, and things like that. The phrases will show up in the issues list beside each warning.
Credit for the little tidbit should go to "Tim" on the Cocos2D forums, (found after Googling for a bit), I believe his solution originally was intended for Xcode 3 and didn't work if you had spaces in your path name, my script here doesn't have those restrictions, still he should get full credit here's his original post.
Like npellow's answer to this question of mine, appCode by JetBrains has also made this possible. So, this may be another reason to use appCode instead of Xcode4, except that it won't be free later in time.
My method:
type in grammar error code in the previous line.....
After changing something in other place, I can go back to the previous place because the grammer error line will show a red line in the right side scroll bar. It indicate the place.
It is not elegant but unless there is a bookmark feature, this is the way i am using at the moment
You can install an Xcode plugin called "XBookmark".
This plugin provide features below :
Toggle Bookmark
Show Bookmarks
Next Bookmark
Previous Bookmark
How to install XBookmark:
Install Alcatraz.
Search XBookmark from Window->Package Manager and click Install.
Restart Xcode.
Now, you can see menus about bookmarks in the Edit Menu.
PS : This plugin is open source.

Resources