Code Monkey home page Code Monkey logo

Comments (7)

dhay3 avatar dhay3 commented on July 28, 2024

如果文件比较多,直接用脚本改方便多了,改成 github 的一劳永逸 😆

import re
import os

owner = ''
repo = ''
branch = ''
github = f'github.com/{owner}/{repo}/raw/{branch}'
staticaly = f'cdn.staticaly.com/gh/{owner}/{repo}@{branch}'
chinaJsDelivr = f'jsd.cdn.zzko.cn/gh/{owner}/{repo}@{branch}'
jsDelivr = f'cdn.jsdelivr.net/gh/{owner}/{repo}@{branch}'
basepath = ''


def redistribution(basepath):
    for root, dirs, files in os.walk(basepath):
        for file in files:
            if file and os.path.splitext(file)[-1] == '.md':
                filename = os.path.join(root, file)
                with open(filename) as f:
                    d = re.sub(f'{staticaly}', f'{github}', f.read())
                    d = re.sub(f'{chinaJsDelivr}', f'{github}', d)
                    d = re.sub(f'{jsDelivr}', f'{github}', d)
                with open(filename, 'w') as f:
                    f.write(d)


if __name__ == '__main__':
    redistribution(basepath)

from picx.

C2yb8er avatar C2yb8er commented on July 28, 2024

已解决图片失效的问题,给作者点个赞!

from picx.

cmty256 avatar cmty256 commented on July 28, 2024

为啥更换链接之后,部署dist之后图片都打不开了?在本地typora是可以看到图片的。

from picx.

XPoet avatar XPoet commented on July 28, 2024

为啥更换链接之后,部署dist之后图片都打不开了?在本地typora是可以看到图片的。

@cmty256
没看明白,请描述清楚,并附带截图。你原来用的是哪中图片链接规则,更换成哪种?

from picx.

cmty256 avatar cmty256 commented on July 28, 2024

为啥更换链接之后,部署dist之后图片都打不开了?在本地typora是可以看到图片的。

@cmty256 没看明白,请描述清楚,并附带截图。你原来用的是哪中图片链接规则,更换成哪种?

就我把那三种链接规则都换成了ChinaJsDelivr,然后部署项目github page之后浏览器打开网站就看不到图片了,但是我本地的md文件是可以看到图片的。
image
image

from picx.

XPoet avatar XPoet commented on July 28, 2024

这种情况作者也不清楚,正常来说,你的图片链接能不能正常访问,只跟你网络环境有关。
建议你把图床部署到 GitHub Pages,然后把图片链接规则替换成 GitHub Pages

from picx.

XPoet avatar XPoet commented on July 28, 2024

@cmty256
另外,遇到问题,不要在此 Issue 评论,请新开 Issue。

from picx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.