-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rawgit URL not work anymore #22
Comments
Here is an example of my URL in rawgit Here is broken The above link give me this error : Invalid upstream response (403) |
Hello @JARVIS-AI, Yes, the rawgit service is ending or has ended (https://rawgit.com/), so this creates an issue with the images not being displayed. As a work around, I edit the links after running readme2tex on my README.md, such that the SVGs are displayed locally on GitHub without the rawgit link. While waiting for an internal bug fix, I could recommend that we use a pre-commit hook which can edit the links for us. I will test it out and post a version here. |
Based on my experiments, the following pre-commit hook solves the issue (in an improvised manner). It essentially re-creates the link to the svg files as local files on your github. This is assuming you have a folder named "svgs" on your master branch. It also removes centering, which is a personal preference. Lastly, it removes svgs in your svgs/ folder that are not being used in your README.md. This ensures only necessary files are present on your repository. To use this file, essentially copy its contents to a file named "pre-commit" within your local repository's /.git/hooks directory. Hope this helps! #!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
b=$(find README.md 2>/dev/null)
c=$(find svgs/ 2>/dev/null)
if [ ${#b} -gt 0 ] && [ ${#c} -gt 0 ]
then
# to remove centering of images, this is a personal preference
sed -i "s| align=\"center\"||g" README.md
# these help to remove the faulty links
sed -i "s|img src=.*/svgs|img src=\"/svgs|g" README.md
sed -i "s|\?invert\_in\_darkmode||g" README.md
# find all used svgs
svgs=$(cat README.md | grep -oP "/svgs.*.svg" | sed "s|/svgs/||g")
# find svgs to delete
del=$(find svgs/*.svg | grep -v "$svgs")
# if more than 0, delete unused svgs
if [ ${#del} -gt 0 ]
then
rm $del
fi
git add .
fi
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against -- |
Thanks for a temp script or fix thanks |
This is still an issue. One workaround is to use the following, with the latest version of this package:
|
I found that the following regular expressions worked better, when combined with sed -i "s|img src=\"\([^/]\)|img src=\"/\1|g" README.md
sed -i "s|\?invert\_in\_darkmode||g" README.md
# find all used svgs
svgs=$(cat README.md | grep -oP "/svgs.*?.svg" | sed "s|/svgs/||g") |
For ‘’nocdn’’ |
Also you probably don't want to do
but instead git add svgs/ README.md |
I don't know why but my math repo was working and I was making ready for my student and teachers in university but that day none of svgs worked
After that I found that rawgit is ended,
Can you see it, maybe I'm wrong ?!!
If it's true can you change the URL for rawgit
Thanks
I change the source code for myself and it's worked
How ever maybe I'm wrong about this.
Thanks for this handy tools
Hail Mathematics for ever
The text was updated successfully, but these errors were encountered: