Is it possible to create an intra-document link with sphinx, such that the displayed text is independent of the link and destination?
Currently, I make intra-document links like so:
.. _Label_For_Section:
===============
Name Of Section
===============
The link :ref:`Label_For_Section` is rendered as "Name Of Section".
The link Label_For_Section_ is rendered as "Label_For_Section".
What I want is a way to have a link, where the destination text, link label, and displayed link text can all be different strings. Eg a link to a section called "A" with a label .. _B: which is rendered as "C"
Note
I noticed that other kinds of links (eg external hyperlinks) are similarly constrained, and I figure the solutions may look similar, however I am looking specifically for a solution for intra-document links.
See Cross-referencing arbitrary locations, specifically the ref role.
:ref:`Link title <label-name>`
I am trying to insert an image in Google Colaboratory (markdown) already saved in Google Drive using this expression ![Text](https://xxxx) but it doesn't work. For example, the Colaboratory markdown manual shows how to insert a photo inline with this example An inline image: ![Google's logo](https://www.google.com/images/logos/google_logo_41.png). Ok, that is a photo from internet, but, when I replace that photo for one already saved in my Google Drive it doesn't appear.
If you have a link like this, then I've got a solution.
https://drive.google.com/file/d/-------/view?usp=sharing
In Google Drive, right-click on the picture
Choose 'Get a sharable link'
Click to 'Copy link'. You need reader permissions. Just need the id of the image.
In my case my link is:
https://drive.google.com/file/d/1xDrydbSbijvK2JBftUz-5ovagN2B_RWH/view?usp=sharing
Now we need to copy JUST the image id:
1xDrydbSbijvK2JBftUz-5ovagN2B_RWH
We will use this base link to generate your link with the image id:
https://drive.google.com/uc?export=view&id=your_id
We then copy the id in the link:
https://drive.google.com/uc?export=view&id=1xDrydbSbijvK2JBftUz-5ovagN2B_RWH
Finally, to place as an image in Google Colab:
![](https://drive.google.com/uc?export=view&id=1xDrydbSbijvK2JBftUz-5ovagN2B_RWH)
I tried all the answers above and nothing worked because of a small change Google has created recently(at the time of writing this post). If you click on "Get Shareable link" and paste it, it would look something like this:
https://drive.google.com/open?id=12BumFEqzKxc9mog8tYuUqvpxf10ot6W3
Now just change the open?id to uc?id and it will instantly work.
According to the answers here
![](https://drive.google.com/uc?export=view&id=XXX)
From the next 3 formats only the first one worked for me:
![](https://drive.google.com/uc?export=view&id=0B3SU50kcW4Q4WFlla00tX3hkdkE)
![](https://drive.google.com/file/d/0B3SU50kcW4Q4WFlla00tX3hkdkE)
![](https://drive.google.com/open?id=0B3SU50kcW4Q4WFlla00tX3hkdkE)
Here is an example using plain html instead of markdown.
<figure>
<center>
<img src='https://drive.google.com/uc?id=1Rb6oXW3KufLApvID5MwxsknpoON2CkQ_' />
<figcaption>Image Caption</figcaption></center>
</figure>
This way, you can also center the image, add captions etc
Unfortunately, I have tried the methods above but they didn't work for me. Then I have tried simply right-clicking on the picture that I want to display on colab, and choose 'Get a sharable link', then the link is automatically copied to my clipboard:
The link will be something like
https://docs.google.com/uc?id=-----
Then using colab's picture inserting button, and insert that link to the (https://) part
![picture](your link)
worked like a magic!
However, if you get a link like this
https://drive.google.com/file/d/-------/view?usp=sharing
after making picture public, it somehow doesn't work.
This below method works for me:
Upload the image on google drive.
Enable link sharing (Right click on image > Get shareable link)
Change access type from 'Restricted' to 'Anyone with link', keep role as 'Viewer', click 'Done'(pop up should close).
Double click on image, Spot 'More actions' icon(top right corner, 3 vertical dots).. click on it and next select 'Open in new tab' from the more action menu, a new windows opens.
Now again, spot 'More actions' icon(top right corner, 3 vertical dots).. click on it and select 'Embed item'. It will give you a HTML 'Embed snippet'.
Copy that HTML snippet and paste it in your Colab noteboook inside a markdown or code cell.
If you use a code cell, you can use magic function %%html (change iframe width and height for your needs).
%%html
<iframe src="link_placeholder" width="600" height="300"></iframe>
I tried all of the above methods, and nothing works for me. However, there is a workaround that bypasses the use of Google Drive altogether: Simply insert the image as Base64 data in normal HTML like so:
<img src='data:image/png;base64, ...lots of base64-data.. style="max-width:100%;" />
If you, for example, are using draw.io to draw a diagram that you want to include, there is a handy option for embedding data (under file->embed). If you choose "image" in this menu, you'll get a pop-up with the relevant code for you to copy. Otherwise there are image to base64-converters online that you can use.
The downside of this method is that you'll end up with a lot of data to paste. However, if you use a dedicated cell for this purpose, there won't be any need to edit that cell ever again.
(As a side note, this method works in most Markdown editors if you for some reason are unable to include an image file. Sometimes it will also work to use SVG data instead of base64, but this does not work in Google Colab.)
Here are my solutions. I liked the first one more.
First Solution :
Step1: First use a wget to fetch the picture, do not use svg file! just png
!wget https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/207px-Jupyter_logo.svg.png
Run the code
Step2: Get the name of the file from last line '207px-Jupyter_logo.svg.png', after you run the wget.
from IPython.display import Image
Image("207px-Jupyter_logo.svg.png")
Run the code!
Second Solution:
use the code below and use png file
from google.colab.patches import cv2_imshow
!curl -o logo.png https://colab.research.google.com/img/colab_favicon_256px.png
import cv2
img = cv2.imread('logo.png', cv2.IMREAD_UNCHANGED)
cv2_imshow(img)
So enjoy :)
Solution for svg or other type of files
![This is an image](https://.......svg)
Anyway, use your link :)
3rd from Github_md_guideline
Once you get the public URL of the image, you can insert it in a Markdown cell
With
![Image in a markdown cell]( https://i.imgur.com/6Z1i8zF.png)
Or in a Code cell (this trick is just in Colab, as far as I know)
With
##markdown ![Image in a code cell]( https://i.imgur.com/6Z1i8zF.png)
So you can have Markdown within a code cell.
Link to shareable image is restricted to unique code associated to that picture. Once you update the picture (happens), then you need to update the link too.
Alternative ways are described here . My solution is given there too, so I will not copy past it here.
You can simply copy the picture in the clipboard and paste it in a markdown cell
In an Xpage running on Domino 9.0.1 I'm using a rich text control with some custom toolbar configuration using the control's "attr" property as it is described here: https://frostillic.us/f.nsf/posts/quick-and-dirty-ckeditor-toolbar-setup-for-xpages
I added the link toolbar template using
<xp:this.attrs>
<xp:attr name="toolbar">
<xp:this.value><![CDATA[[["Link", "Unlink", "Anchor"]]]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
All three buttons are displayed fine, esp. I'm able to define an anchor link target.
But trying to reference the anchor target I find that the Link dialog is somewhat incomplete as I can't define my link to use a relative target on the same page. I tried entering a reference in the dialog's URL field as #myAnchorId, but that results in a link looking like this:
....
Here's an image of the dialog that pops up from my Xpage when I hit the "URL link" button:
And this is what the dialog looks like that I can test from the CKEditor Samples page:
I'm aware that the samples page uses CKEditor V 4, so the dialog is somewhat different, but even V 3.6 should be able to reference anchor links using the dialog.
I already looked up on the installed ckeditor's version; \DominoData\domino\html\ckeditor\version.txt says:
cke_version=3.6.6.2
cke_revision=20130606-1534
Question is: what's missing here? Do I have to somehow modify the dialog?
Oh my, finally got it to work; #IBM: this feature truly could use some proper documentation! I'll mark this answer as a community wiki.
Indeed a different dialog is used here, which btw appears to apply to all the dialogs in use with Domino's CKEditor implementation. The trick in my case is to use one of the custom toolbar items instead of the standard one; up to now I found three of those customized items:
use MenuLink instead of the standard Link item; this item
consists of two sub items ('URL Link' and 'Anchor Link'), each calling its own dialog version; the resulting toolbar definition then looks like this: ['MenuLink', 'Unlink', 'Anchor']
use MenuPaste instead of the standard Paste item; again, this
item consists of two sub items ('Paste' and 'Paste as text'), again
each calling its own dialog version
use LotusSpellChecker to add IBM's own spell checking feature, where CKE's standard spell checker isn't working
I found hints to those three custom items inside my local \DominoData\domino\html\ckeditor\config.js. Don't know if those are all custom items available to day.
EDIT:
IBM's Domino Designer Xpages User Guide mentions another means of customizing the toolbar; the section unfortunately is incorrect in describing the options for the toolbarType attribute: be aware that all named types must start with capital letters, e.g. Basic, Slim, Medium, Large, Full, while the also mentioned Lite type isn't working at all; mistyping or using a non-existing value results in the editor not being displayed at all.
The link dialog that you're using is not the default one, so you should check how to modify it or replace it with the default one.
I have a tumblr account that has submission enabled, and I have a short description with a form in the "description" area that appears on the sidebar. However, this description also appears on myblog.tumblr.com/submit. I'd like to remove it.
I looked at the documentation on http://www.tumblr.com/docs/en/custom_themes#navigation, but haven't been able to figure out how to prevent the sidebar description from showing at the top of the submit page.
Can anyone help?
I'm not sure if I understood your question correctly. But if I did, a work around would be using jQuery to check if the current url contains the string /submit and simply disable the sidebar, or the element that contains the description.
I don't know jQuery but I know it's possible. I'd suggest you to look into this post:
How to check if the URL contains a given string?
and combine it with this line (replace the "alert part")
$("#sidebardescription).hide();
Another solution would be if Tumblr provided you with a way to only render for specific pages. They usually do that. I'd look into this part {block:SubmissionsEnabled} {/block:SubmissionsEnabled} before I go with the workaround.
So I have a website that has just two pages. On the home page, there are some things going on, but are not important. There are some links, however, that will need to link to a specific piece of content on the second page.
On the second page, I have content on there and it's all encased in the jcycle plugin.
What I need to do is if someone is on the homepage and they click on a link, it needs to load up the second page and show the correct "slide" that corresponds to what the homepage link is.
If you need any more clarification, please let me know.
In the cycle options reference, I see that there is a startingSlide option. You could set that dynamically. You could either do it with server-side code, e.g. /foo?slide=3 or you could check which anchor reference was used on the incoming link, e.g. /foo#slide3. Or, you could use DHTML to build the slideshow on the homepage when they click the given link.
Also note that there is a slideExpr option that you could use to filter the slides to a smaller set, depending on what they selected.