Jupyter Notebook cell output cut off/truncated by margin caused by Jupyter Themes - output

My cell output in Jupyter Notebook is cut off on the left hand side which obscures the leftmost output. For reference (I can't post images yet):
https://imgur.com/gallery/rg759nN
Any idea how to fix this?
EDIT: Thanks to rabbit on below, the problem seems to be caused by using the alternate themes provided by Jupyter Themes

Found the solution on Jupyter Themes github page:
https://github.com/dunovank/jupyter-themes/issues/288
"In the custom.css file, I fixed it by changing both the div.out_prompt_overlay.prompt's and the div.out_prompt_overlay.prompt:hover's min-width and width values to 11.5ex instead of the original 14.5ex."
Alternatively I added the padding:
div.output_area {
display: -webkit-box;
padding: 13px;
}
To the chesterish.css file (which was the theme I was using) and reapplied the theme using jupyter themes.

Ctrl + Shift + C to open DevTools in the browser.
go to Sources and click on static
search for: div.output_area
change padding to 13px
(The developer missed 1 and put only 3px distance)

This was raised as a bug and fixed (see https://github.com/dunovank/jupyter-themes/issues/273). As stated by Ernest in a comment: the solution is to upgrade the package and load the theme again i.e.
pip install --upgrade jupyterthemes
jt -t {theme}

you need to fix the container-margins in the command line by:
jt -m 100
and then:
jupyter notebook
(100 was good for me)

Related

How to compare modified Jekyll Theme to original?

I've modified the Jekyll Cayman theme. How do I track it to the original so I can see when original changes and I need to recopy and modify it?
I tried using wget followed by diff but the results were nonsensical. Here are the original and modified links that display fine in the browser but appear to be garbage when downloaded with wget:
Original theme - jekyll-theme-cayman.scss
Modified theme - jekyll-theme-cayman.scss
GitHub Pages are Rendered in HTML
The file you view using GitHub will contain a plethora of HTML. What you want is to skip the HTML and download the raw code as this Stack Overflow answer describes:
How can I check out a single file from GitHub without cloning the whole repository?
Step-by-Step Instructions
First download the original Jekyll Cayman Theme file in raw format:
wget -O original 'https://raw.githubusercontent.com/pages-themes/cayman/master/_sass/jekyll-theme-cayman.scss'
Then download the modified Jekyll Cayman Theme file in raw format:
wget -O modified 'https://raw.githubusercontent.com/pippim/pippim.github.io/main/_sass/jekyll-theme-cayman.scss'
Now compare the two files with the diff command:
$ diff original modified
0a1,5
> /* Github Pages Jekyll Cayman Theme. Make code block font size larger. Copied from:
> * https://github.com/pages-themes/cayman/blob/master/_sass/jekyll-theme-cayman.scss
> * Source code version: January 2021
> */
>
223c228
< font-size: 0.9rem;
---
> font-size: 96%; // Change 0.9rem to 96% for proper size in headings
238a244,248
>
> /** Code Block scroll bar From:
> ** https://stackoverflow.com/a/38490989/6929343 **/
> max-height: 400px;
> overflow-y: auto;
277a288
>
Analyzing the diff Results
The > shows what you've added to the theme. If there are < then that is what your copy of the theme is missing. When that happens, copy the theme's file over again to your repo and then add back your revisions.
In this case only a single line appears in the original that isn't in the modified version:
< font-size: 0.9rem;
As this line was intentionally deleted from the original version (because it wasn't working properly) the original version has not been updated since it was copied and modified.

React path to public folder in css background image

I am using Create-React-App and I want to add background image for my header section and I am doing this in that way:
background-image: url('~/Screenshot_11.png');
After this I'm getting this error:
./src/styles/main.scss
(./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-3!./src/styles/main.scss)
Module not found: You attempted to import
../../../../../../../Screenshot_11.png which falls outside of the
project src/ directory. Relative imports outside of src/ are not
supported.
I've set up homepage in package.json
"homepage": "http://localhost:3000",
In my older projects that works but today I cannot import this correctly.
They have changed that but I don't know why. Working path:
background-image: url('/Screenshot_11.png');
EDIT 2021
For people who think that it doesn't work:
https://codesandbox.io/s/agitated-turing-gsnr3
you can import that image as
import Background from './Screenshot_11.png'
and use
background-image: `url(${Background})`
This still does not work for me with images in the public folder.
UPDATED 19 March 2021
Regarding using of <ROOT/public/images> in .css files.
It appears to be a breaking change (will be considered as a bug?) in create-react-app (react-scripts) package v4.x.
And more precisely in package 'css-loader' v4.x.
3.x branch works OK with that.
Here is the corresponding issue on the github repo:
https://github.com/facebook/create-react-app/issues/9870
(and there are few more actually).
No fixes (yet). (will be?..)
But a few workarounds mentioned there.
Which one to use... it depends on your project, I suppose.
Some of workarounds:
downgrade to react-scripts 3.4.x
don't use url in CSS files :) you still can use in .JSX (inline styles). Or put in .html. They are obviously not processed by css-loader.
reconfigure webpack to add url:false to css-loader options (either eject CRA or use this: https://github.com/gsoft-inc/craco or this: https://github.com/timarney/react-app-rewired
(you can find sample configurations at the github issue page)
use this new feature of css-loader https://github.com/webpack-contrib/css-loader/pull/1264
(released in 5.1.0, current last version is 5.1.3; to use that version you can add the following to the package.json: "resolutions": { "css-loader": "5.1.3" } (at root level) )

Comment snippets package of sublime text is not working in css

I installed sublime text and included comment snippets (https://packagecontrol.io/packages/Comment-Snippets) it's working in html and others languages but it doesn't work in css whenever i wrote my comments like this:
comm-section
it gives me this output:
comm-section: ;
in html
/*=============================================
= Section comment block =
=============================================*/
/*----- End of Section comment block ------*/
how to be fixed in css like in html
Thanks for replying
I've had this problem before, the main reason why this isn't working is because you have "EMMET" package installed and it's overriding it.
If you find yourself not really using EMMET's shortcut for css, you can disable it in EMMET's settings.
Go into Sublime: SublimeText -> Preferences -> Package Settings -> Emmet -> Settings User
Open it and type in:
{
"disable_tab_abbreviations_for_scopes": "source.css"
}
Save it, then try your comments again. It should work now.

R Markdown with the DOCCO linear style

I was about to write a package's vignette using DOCCO linear style that is supported by knitr package (knitr).
In their example vignette there appears a nice graphic at the begging and at the end of HTML file.
But when I tried to maintain my own vignette those graphics didn't appear and instead of them there appear a huge 8 and h letter :P Like below:
.
Can any1 tell me why this is happening and maby how to fix this?
I am converting my vignette written in .Rmd to .HTML using this syntax:
Vignette:
<!--
%\VignetteEngine{knitr::docco_linear}
%\VignetteIndexEntry{The archivist package compedium}
-->
# The archivist package compedium
```{r}
summary(cars)
```
and function to convert this:
knitr::knit2html(input = "vignettes/archivist.Rmd",
output = "vignettes/archivist.md",
template = system.file("misc", "docco-template.html",
package = "knitr"))
Note that you should have npm installed on you computer.
Installing via terminal:
sudo apt-get install npm
and then installing docco:
sudo npm install -g docco
Thanks for any advice !
EDIT:
Firstly, after markdown compilation, I opened my vignette file under ubuntu's firefox on an Oracle Virtual Machine where it was created because I could not download and install docoo on a Windows. It appears with ugly 8 in output file.
But when I sent this file via e-mail to myself and opened it on a Windows it looked perfectly as I desired it when producing. Check below
And so, I opened knitr vignette manual explaining the docco style on a ubuntu on Virtual Machine in firefox and it appears it has the same 8 sign !
I think it must be some kind of encoding problem ? Am I right? Good it works and looks good after sending it to a Windows :P
Can any1 explain me this nonsense I lost most of my day on ?
Thanks :)
That content is added via CSS in the docco.css file. For the header image, they have
h1:after {
content: "8";
display: block;
font-family: "fleurons";
color: #999;
font-size: 80px;
padding: 10px 0 25px;
}
So they are inserting an "8" into the page after the header. But they have specified the font as "fleurons". This is a webfont they have also defined in the same css file.
#font-face {
font-family: 'fleurons';
src: url('public/fonts/fleurons.eot');
src: url('public/fonts/fleurons.eot?#iefix') format('embedded-opentype'),
url('public/fonts/fleurons.woff') format('woff'),
url('public/fonts/fleurons.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
So in order to get the "8" to look like the fancy symbol they have, you need to have this particular webfont available to your webpage. Same goes for the "h" at the end of the page as well.

Invalid PNG Image file: iDOT doesn't point to valid IDAT chunk

I have some HTML content pages in an app and I'm using a UIWebView to display them. Some of these pages have a PNG image in them that is generating the following message in the debug console in xcode:
ImageIO: PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk
The image still displays and looks correct. Also this only happens when I run the app on an iPad (3rd generation). My iPhone 4 doesn't display this message.
My first thought was that it was caused by a ~ character in the filename (I've added the ~ipad tag to the filename). However, removing the ~ character doesn't have any effect.
I've done a google search but I only get 3 results. 2 of them are in Chinese that doesn't seem to be translated well by Google's translater. The other results seems to be someone with the same issue as me, but no responses to his post.
Had the same problem. Solution:
use "color sync utility" which is a standard program, you can load from launchpad. Open the png file and save it with the utility.
'cleaning' the project (xcode menu path : product -> clean) solved this exact issue for me.
Resaving the .png with a new name did not.
Image did appear in the simulator but not on the test device (ipod touch 5th gen.)
Very large image 4000 x 4000
Strangely, I had the exact same issue just about an hour ago. I didn't find a particular reason for why it was failing, but I think I was able to "fix" the image to make it display properly and not throw an error.
I just opened it in Preview and exported a new PNG file from the source. Once I replaced the bad image in my project file with the newly created one, I cleaned, compiled and it worked as expected.
Hope it's as easy as that for you...
You may want to check you don't have another file with the same name in another directory. That is what caused this error for me .. (duplicate Default.png)
I had the same problem with my app.It turn out that the images that the user was uploading to my server and edited with php +imagemagik where striped out.I was using the following command to edit the uploaded image:
convert $uploadfile -resize 300x300 -quality 30 -strip $uploadfile
When i removed the -strip parameter the error was disappeared !
Same problem here.
1 - Close XCode;
2 - Open the image in Photoshop;
3 - Re-save ( replace the same image ) with 80% quality;
4 - Open XCode, clean it CMD + SHIFT + K;
5 - Build it in your device again;
Very simple and work for me.
And for you ?