GitLab: How to embed image from repo in the wiki? - gitlab

I have a GitLab repository with documentation in the attached wiki (i.e. NOT in the repo itself) and an image file inside the repository itself that I want to embed in wiki pages.
How can this be done?
From a wiki page, I can successfully link to the image using
[[../tree/master/pathto/myimage.jpg]] or [[../raw/master/pathto/myimage.jpg]] but
![](../raw/master/pathto/myimage.jpg)
doesn't seem to work.
(GitLab Community Edition 10.0.3)

Embedding using the absolute path to the repo and image worked:
![](https://url.of.my.repo/raw/master/pathto/myimage.jpg)

Use the 'Attach a file' button from the wiki page:
It is a triggy operation but sometimes it works :) and you find your attached image:

Related

Does SourceForge have a Subversion repository search feature?

Is there a way to search the Subversion repository of a project hosted on SourceForge? I see that I can Browse Commits/Files but I'd like to perform a full text search. If no such feature exist, is there a workaround like a way to export the entire SVN repo (I'm not the project owner)?
An example, I'm a user (not project owner) trying to find changes involving the ORB_ID_STRING literal on the omniORB project.
I unsuccessfully attempted to answer this question by: searching stackoverflow, searching using various Google keywords like "sourceforge how to search SVN". I also submitted this SourceForge support ticket: https://sourceforge.net/p/forge/site-support/20997/.
Here is the reply I got from SourceForge Support on Monday July 20, 2020:
Dave Brondsema -
Hello,
We do not currently offer an option to search the full text of a code repository. You
can download the repository yourself though and do a search yourself. The easiest option
is to use the "Download Snapshot" link in the upper right of a code repository. Note:
you probably want to be in the "trunk" folder first or it will be a very large download
including copies of all the branches and tagged versions of the code. Alternatively, you
can install SVN on your computer and do an SVN checkout of the repository.
Sincerely,
SourceForge Support

I have accidentally deleted a page from Azure DevOps Wiki. How can I recover it?

I have accidentally deleted a Wiki-page from our repository in Azure DevOps.
(How) can I recover it?
That is not an option for us, since we will loose many changes that
were made after the last version no. up until the date I accidentally
deleted the wiki page.
You can choose Clone wiki to download the wiki repo to local machine.
Then use git commands(git revert or what) locally to get the deleted page, once you find the deleted page, publish it and add it back to Wiki page as a new commit.
I was just able to do this without too much fanfare. The resource that was helpful was this VS community topic. There is an answer that provides a solution that doesn't require you to clone the repo.
The key insight is that you can navigate to the Azure DevOps repo UI for the Git repo that's backing the wiki. The solution author says that the shape of the URL is something like https://dev.azure.com/<organization-name>/<project-name>/_git/<wiki-name>.wiki. This didn't quite work for me because we have a different URL scheme in our organization, but I was able to figure it out after a little trial and error. I later saw that you can get the URL by using the Clone Repo UI in the wiki - it gives you the URL, so you can just copy it and navigate to it.
Anyway, the steps were:
Figure out the URL of the git repo that backs the wiki
Navigate to the revision history for the entire wiki
the current UI shows you the Contents tab by default - switch to History
Scroll until you find the commits that deleted the pages you want to restore
it's one of those list views that populate themselves as you scroll, so you won't be able to use the browser page search efficiently, unfortunately
Revert the commits
In my case, this required clicking on them and creating pull requests to revert, but I was able to merge them myself without involving code reviewers. YMMV
All in all, not a wholly terrible experience, but completely undiscoverable.
Assuming you're managing a provisioned wiki (vs using published code as a wiki):
Look in the top-right corner for the vertical 3-dot menu, where there's an option to view revisions:
Choose the revision you want to revert to (e.g. the one prior to deleting the needed wiki page), from the list (click on its version hash):
From the revision details, select "Revert":
At this point, your wiki should be at its prior state, and your wiki page should once again be available.
Note: If you're using published code as a wiki, you would recover/revert your changes as you would with any other code commit.
More details may be found here.
I couldn't find a way to do this through the Azure DevOps web interface but you can restore the page by reverting the commit that deleted it if you clone the wiki locally.
Clone the wiki to your computer - find the clone wiki option in the menu at the top of the left bar which shows the wiki contents, copy the URL and use to clone locally using your usual git client.
Find the commit that deleted the page, the commit message will start with "Deleted page" then the name of the page you deleted.
Restore the page and commit the change. There are various ways to do this - I reverted the commit, you could checkout the commit and copy the page out to make a new commit. You may get a merge conflict on '.order', I'm not sure what the best thing to do is but I kept the current version and haven't had any problems.
Push the changes to Azure DevOps, refresh and you'll see the page has been restored.
This works even for Project Wikis. I wonder if Azure DevOps has added the functionality that enabled this since some of the other answers have been written.

Github CLI Beta: How to view readme inside a folder

I recently stumbled across Github CLI Beta. It allows for viewing repos, cloning, forking, and creating repos all from the command line.
My question is the following: How can I view a readme that is inside a folder of a repo?
I can view this one:
bhristov96/example_repo/README.md
How can I view this one?
bhristov96/example_repo/src/README.md
The syntax to view the repo is the following:
gh repo view OWNER/REPO
Specifying anything further doesn't work:
gh repo view OWNER/REPO/FOLDER
Is there a different way to accomplish this, or is it just not supported yet?
Thank you for your time!
Looking at the current cli/cli command/repo_test.go # TestRepoView, I would say: not supported
You can see the repoView() implementation: it uses
readmeContent, _ := api.RepositoryReadme(apiClient, fullName)
And RepositoryReadme is just a call to the GitHub Repository "Get README" API
So it is for now limited to the official README (at the root of your repository)
But it would not be such a stretch to propose another function which would call the Get contents API, with any path you want as a parameter.

How to embed src file in a wiki in Gitlab/Github?

I have a doc folder in my project (in Gitlab) which contains documentation generated using jsdoc. This documentation is generated at build time.
What I want to do now is to embed the resulting index.html file in a wiki, so that on each build, the wiki is automatically updated.
Is there a way to do this?
You can clone your GLitab wiki locally.
That means, after each local build, you can add one step to your build in order to modify and embed the content of the generate files (here the resulting index.html), then add, commit and push back to your GitLab wiki.
As the OP tigermarques adds in the comments:
The only extra thing I had to do was to rename the .html file to either .md or .txt so that Gitlab would show it on the Wiki page list.

Update a GitHub project wiki through the GitHub API

Is there a way a developer can automatically upload Doxygen documentation for his project hosted on GitHub through their API?
I didn't find anything on develop.github.com related to this. It would be nice if one could just SCP the files or something.
It's now possible to check out the wiki as a separate Git repository. You could clone the repository, add the pages to it, and push it. You can clone the repository from this URL:
git#github.com:user/project.wiki.git
There is no way, at this time, to access the GitHub wiki via the API. However, there is a much better solution already built into GitHub. Since Doxygen outputs static HTML pages, you can push them to the gh-pages branch of your project and access them at username.github.com/projectname
For more information, http://pages.github.com/.

Resources