How to embed an image on Github - github

I use gh-pages to host a website, and I am familiar with markdown. My question, though, makes reference to inserting an image (perhaps saved within Issues) so that it is visible on a regular repository code file. Something like this:

If that file is .md or .rst(not sure if it works for other), you can do that either by saving image to your repo, or to the issues and then if image is in repo you can access it either with absolute or relative path:
![](raw path to your image - click on raw and copy&paste)
![](folder/image.png) folder is in root
If you mind sizing, use html, though I'm not sure if it works with relative paths too.
<img src="<url>" width=500></img>
It's not possible to embed an image so it'd be visible in your raw code as I see on your image. To accomplish it only in a similar way, put your code in backticks and leave the rest in markdown or html.

Related

Markdown: Reference to section from the same file

I'm writing a wiki in Git and I'd like to reference another section within the same page. I'm trying to reference a section that is within a drop down. It looks like this:
<details><summary>Component</summary>
### Section I'd like referenced
</details>
[Link to ### Section I'd like referenced]
Any ideas? Is this even possible in Markdown? Note that this is within the wiki, and not a .md file in the repo
In other Wiki engines, and I presume with GitHub as well, this doesn't work because the disclosure element's contents, and therefore the link, are hidden and the browser can't navigate to them. The best I could do is to link to something just above my disclosure element, might even add a hidden one myself, e.g. <span id="link-here"/>

How do I move or include compressed and concatenated CSS to footer in TYPO3?

Seems like a simple question, since you can do it with JS files, but I can't seem to find an answer.
I know for javascript things like moveJsFromHeaderToFooter and includeJSFooter exist in typoscript config, but no such setting for stylesheets.
I compress and concatenate my stylesheets as well, so the result isn't a static file either.
I am not discussing its right or not but if you want to move whole CSS to footer here is the solution:
Copy file public/typo3/sysext/core/Resources/Private/Templates/PageRenderer.html to some location in your basic extension like myext/Resources/Private/Templates/PageRenderer.html
In Template Typoscript put:
config.pageRendererTemplateFile = EXT:myext/Resources/Private/Templates/PageRenderer.html
In myext/Resources/Private/Templates/PageRenderer.html you see markers. Just move CSS markers you want to bottom.
The style tag is only valid in the head section. Thats why TYPO3 does not provide a move to footer option.
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
So please create valid html

What is the best way to enable content authors to add images with captions in Expression Engine

There's a module to do this in Drupal land, but I've been frustrated with the hacks that've been necessary in Wygwam. What is the best way to go about implementing this in such a way that you don't need to totally override the default image handling in ChannelImages/Wygwam?
Assets is a good suggestion, but I believe Devdemon's channel images might be a better fit for the workflow you're suggesting.
http://www.devdemon.com/channel_images/
Clients can add (and see) a caption and more and it's fully integrated with Wygwam and other editors. Devdemon's support is also excellent.
The Assets module from Pixel & Tonic allows you to double-click on the image (or any other file) and add metadata. You then have access to the metadata in your templates.
Check the screenshot: http://pixelandtonic.com/assets
You can also add metadata using the native File Manager. Click the edit icon from the File Manager and you'll see a few fields. You can use the File Entries tag to access it.
http://expressionengine.com/user_guide/modules/file/file_tag.html
I typically use Matrix with one column for the image, one column for the caption, and if a link is needed another column for the link. This of course works best if the image is in a fixed location within your template.
On possible way to accomplish this that I have used is to run some jQuery that looks for images within a certain area, and if they have alt attributes, rewrite the image tag within a tag with a tag inside.
so:
jQuery(document).ready(function() {
$('#page-content > .wrapper img').each(function(){
if($(this).attr('alt') !== undefined && $(this).attr('alt').length > 0){
if(!$(this).parent().hasClass('content-image')){
$(this).replaceWith("<figure class='content-image "+$(this).attr('class')+"'>"+$($('<div></div>').html($(this).clone().attr('class',''))).html()+"<figcaption>"+$(this).attr('alt')+"</figcaption></figure>");
}
}
});
});
will do just that. It's looking within a #page-content div for img tags with alt attributes. And then rewriting it as
<figure><img src='....' .... /><figcaption>This is the text that was in the alt attribute</figcaption></figure>
Soooo, that kinda works. The only caveat is that you had better not use any double-quotes within your alt text, or it will break thangs. Not the cleanest of solutions, but a solution, nonetheless.

GWT getUrl does not return image

I have an image in my war folder. I am trying to see what the image is, but I cannot get it to work. I am trying by using GWT.getModuleBaseURL()but it does not alert.
if(soundImage.getUrl().equals(GWT.getModuleBaseURL()+"/soundOn.png")){
Window.alert("YEP IT DOES");
soundImage.setUrl("soundOff.png");
setSound("off");
}else{
soundImage.setUrl("soundOn.png");
setSound("on");
}
How can I get the image? Am i overlooking something in my code, or am I doing it wrong?
Changing the URL of an image in order to change the view is understandable if you have an HTML background, but is sort of crazy in GWT-land. This is roughly analogous to changing the URL of a <script> on the fly -- it's technically possible, but strange. This image is a child of some component, necessarily. I would replace this image by operating on the component that contains this image, and not on the image itself by changing its URL. The URL of an image is essentially its descriptor, so it's awkward to change a property like this. If you are using MVP and have created a View, then you might expose a method like void toggleSoundImage(boolean on).
You really should be doing this instead: https://developers.google.com/web-toolkit/doc/latest/DevGuideUiImageBundles. The way you are trying to use images is unidiomatic -- some people might call this "wrong".
I purposefully did not answer your question because if you were doing this correctly, the preconditions that caused this problem wouldn't exist.
Hope that helps.
Notice you you are setting the url (soundOn.jpg) using a relative path, but you are checking using the module absolute path.
The URL should merely be the same as the src attribute on your image.
If you use:
if(soundImage.getUrl().equals("soundOn.png")){
It should work. I recommend using Travis' recommendation of Image resources, also.

TinyMCE - Setting up for EE tags

I've got a TinyMCE plugin that I'm using in Expression Engine. Problem is though I'm going from a textarea with code that uses EE tags to this and when saving it's breaking code.
For example, for an image I'll use src="{site_url}/image/logo.png", TinyMCE then rips out or corrupts the {site_url} part and try to and replace it with a relative path which (as site_url isn't at the root) is wrong.
I know you can add new tags for TinyMCE to respect in the config but this only assumes those wrapped in <> and not {}.
Anyone know if I can adapt this? Or have a better solution of something that will respect it?
Since TineMCE is a wysiwyg you need the full image path in order for the TinyMCE to render the image. I would recommend backing up the database and then running a find replace and replace on the old paths via sql: http://www.mediacollege.com/computer/database/mysql/find-replace.html