Skip to content
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

一些小bug #2

Open
IamJayden opened this issue May 16, 2014 · 2 comments
Open

一些小bug #2

IamJayden opened this issue May 16, 2014 · 2 comments

Comments

@IamJayden
Copy link

图片加载的时候,如果是上一层目录会出现下面这个问题,

<img alt="avatar" src="p/Diary/Directory/../img/lover.jpg">

加载图片时,加载了两次,而且有一次路径还是错误的,报错如下

Failed to load resource: the server responded with a status of 404 (Not Found) http://iamjayden.github.io/img/lover.jpg
@fritx
Copy link
Owner

fritx commented May 29, 2014

// ## renderer
    var _rndr = new marked.Renderer();
    var rndr = new marked.Renderer();
    rndr.link = function(href, title, text){
        var flag = href.search("/") == 0 || href.search("://") > -1;
        if(!flag){
            href = '#!/post/' + href.replace(/\.md$/, '');
        }
        return _rndr.link(href, title, text);
    };
    marked.setOptions({
        renderer: rndr,
    });

可以考虑 @t09def 的这种做法
定制renderer 而非后处理

@fritx
Copy link
Owner

fritx commented Oct 14, 2022

时隔多年,现在已无法复现,可能是浏览器优化,也可能是postProcess曾经做过优化

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants