I am quite new to Jekyll and I am not sure how I can go about creating a website with p5.js sketches embedded into it for a project that I am working on.
I suspect it has something to do with dependencies and I would much appreciate any help/pointers I can get!
There is nothing special about the combination of Jekyll and P5.js.
The important thing to understand is that the output of Jekyll is "just" regular HTML. You can include a P5.js sketch inside any HTML page. So you can include P5.js in Jekyll just fine.
Here is an example page that embeds a P5.js sketch in a website created using Jekyll. Here is the source markdown of that page. Jekyll takes that markdown and outputs HTML.
It's going to be hard to be more specific than that, but the general answer to your question is to focus on the HTML and focus on any errors you're getting.
If you still can't get it figured out, please post new question that includes a link to an example Jekyll repo that shows the error, and include the full error in your post.
I wondered the same and #Kevin Workman's examples worked. Note that you don't need to add the entire javascript code in a script object, you can point to it (I for one didn't know any of this until an hour ago)
You can add something like this in your post's .md file to reference a file called "myjavascriptfile.js". Note you can also use a hosted version of the p5.js file
<div id="sketch-holder"></div>
<script src="https://cdn.jsdelivr.net/npm/p5#1.1.9/lib/p5.js"></script>
<script src="myjavascriptfile.js"></script>
The "sketch-holder" thing gives you a bit more control over the sketch and requires you to add this to the setup() function:
function setup() {
....
const canvas = createCanvas(something, something)
canvas.parent('sketch-holder')
....
}
Related
I'm running my processingjs sketch locally and I'm trying to save a PNG of my canvas but I can't get the regular commands saveCanvas("image", 'jpg'); and save("diagonal.tif"); to work.
Does anyone have a tip on how to get this done?
Cheers,
Thales
Questions like these are best answered by looking in the reference.
Take a look at the documentation for save() and saveFrame(). I'm not sure where saveCanvas() is coming from, but I don't see it in the Processing.js reference. Are you thinking of P5.js?
Anyway, the documentation says:
These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu.
This makes me suspicious that these were only designed to be used from the Processing editor.
Take a look in your developer tools to check the JavaScript console for errors. What do you see when you try to call the save() or saveFrame() functions?
I'd also recommend googling "processing.js save image" for a ton of results, including:
save image to a png file using processing.js
How to export an image or PDF from a Processing Javascript mode sketch?
Processing.JS save() help
If you still can't get it working, please link to a CodePen or JSFiddle with a simplified MCVE that demonstrates the problem.
I use github, github-pages, kramdown and jekyll to publish my static sites.
I need to embed html comments that are visible when viewing the source of a page. The reason for this that I want to be able to visually use comments to differentiate between the different parts of raw source html markup. This is doable by using regular html syntax:
<!-- here's my comment -->
The problem I've encountered is that while I serve my jekyll site locally I do see comments in the page source, but once pushed to my github repository the comment isn't visible anymore. However it's still visible in my repo when viewing the raw markdown source file.
The behavior I expect would be seeing my comment in the page source code like I do locally. I've tried kramdown comment syntax:
{::comment}
here's my comment
{:/comment}
This works but this way I don't see it in the page source at all. Another solution I've tried is the workaround described in this response. It works but it produces an actual html tag and therefore any clear separation between the comment and the other html tags is lost.
The bottom-line is that I want to see the comment when viewing my page source even after pushing my files to my repository.
Is there something I'm missing here or isn't it possible to keep html comments intact while used in conjunction with github-pages?
EDIT: Turns out it was not a markup or Github problem after all. I use a CDN service, this minified the HTML and stripped away HTML comments.
Please check there is no "HTML Minification" running on GitHub which could be actually removing comments while serving for save bandwidth.
I recently set up my blog on abhitopia.com. The issue I am facing is that all the code I write in my blog (in markdown) cannot be copied. For instance, go to
http://abhitopia.com/machine%20learning/2016/05/22/tensor_flow_exploration.html
You will be unable to copy code. I have already tried googling this. It is definitely not a feature that comes pre configured with Jekyll. I don't understand why. :(
This is not related to how Jekyll is building your site. This is a problem with the theme that you are using (Grayscale), which gives you the impression that you cannot select text in your code blocks.
If you look at your grayscale.css file around line 409, you'll see something like this:
These two styles are removing the shadow that one sees when selecting text, which makes you think you cannot copy the text.
Remove these two styles, or modify them, so that the shadow is visible and in a color you like. Alternatively, you can use a different theme, instead of that one.
Im trying to locate certain javascript code in the codebase with no luck. This code appears in the head of every page. Note that it isnt a link to a file but certain code embedded in the head. I have tried the following ways but no luck
local.xml
head.phtml
page.phtml and all page templates
page.xml
Text search in codebase with keyword and
keyword '{variablename}'
Database search keyword '{variablename}'
but no results so far
Have a missed something? Any help would be really appreciated.
Thanks,
Loveleen
Assuming that the page templates still generally reflect the native Magento structure, if it's in the <head> of the page, then it can only be coming from one of three places:
The page template (1column.phtml, 3columns.phtml, etc.).
The <head> include file head.phtml.
An include of one of the first two.
I know you said you already looked in both of those places, but you can help narrow down the source by comparing what you can see in those locations with what you see in the generated page source. Is the analytics code you're trying to locate before or after something you can see in those template files?
Also make sure that you're looking in the template files of the correct theme.
Ok got it.. it was under System>Config>Design>Misc Scripts
Ok. I have some experience with HTML and CSS, little with Javascript and none with JQuery.
And I'm trying to try out in my HTML file the Galleria plugin with fullscreen theme but I can't make it work. ( http://galleria.aino.se/ )
It only show the empty page with no pictures. I took the source code from the demo page and I pasted in my page and after some little modifications with the url of the theme, I managed to have on my screen only the image, without the "mechanism". Any help?
I think the instructions were made for an old release of the plugin and that's the reason I can't get it work.
P.S. I found a ready made demo on googlecode, but I can't get the fullscreen feature. Any help?
Try passing debug:true to yield more errors if you are seeing a blank page. Regarding customizations, try the documentation and API reference.