hexojs/hexo-renderer-pandoc

Publish 0.2.7 on npm

Ritsuka314 opened this issue · 5 comments

Turned out that my fixes 947ea9d and d2c7636 included in 0.2.6 would fail on mac and unix due to different EOL sequences used on those two systems. As part of the fix at 2042bb5, this issue is solved. @wzpan could you please publish it (0.2.7) to npm? Thanks a lot.

with pandoc 2.7.1, seems only version 0.2.3 below works fine.

@sli1989 Thank you for your reporting.

  1. Could you elaborate on how versions above 0.2.3 failed with pandoc 2.7.1? I realise I have not used pandoc beyond 2.6 so I do not know what went wrong in your case.
  2. Appearing to me, your issue does not relates to this one. Unless it does, and please fill me in if that is the case, would you mind open a separate issue, so we can discuses point one over there?

Many appreciates.

IDK which is related.

environment: pandoc-2.7.1-windows-x86_64.msi+WIN10

  • with npm install hexo-renderer-pandoc@0.2.3 --save

image

but in .md file

Pandoc is a universal document converter!对 md 扩展支持让我拜倒,例如[脚注的支持](http://pandoc.org/MANUAL.html#footnotes)部分。需要提醒的是:pandoc 渲染器对 md 的格式要求更加规范些,例如 链接需要用`< >`括号显式包含;quoteblock 每行必须跟两空格表示换行(如果后续行没有`>`标记的话)。当然,把 [Pandoc’s Markdown](http://pandoc.org/MANUAL.html#pandocs-markdown) 浏览一下是很有必要的,或者 [pdf 版本](http://pandoc.org/MANUAL.pdf)。

1. 第二种方法,使用Pandoc渲染器:

    在文件`/layout/_layout.swig`中`/body`前加入:

    ```
    <script type="text/javascript" src="/js/custom.js"></script>
    ```

    在`/themes/next/source/js`中添加文件`custom.js`,在`custom.js`中添加

    ```
    // 函数: html 中去掉 某 tag 最后那一次出现
    var rmLastElm = function(text, selector) {
        var wrapped = $("<div>" + text + "</div>");
        wrapped.find(selector).last().remove();
        return wrapped.html();
    }
    // 弹出 tip 显示 脚注
    var $fRef = $(".footnoteRef");
    for(let i=0; i<$fRef.length; i++) {
    	var sup = $fRef.children("sup")[i];		//work reliably as long as there's exactly one sup per footnotRef
    //	var sup = $fRef[i].children("sup");		//a classic Dom Element, so it doesn't have any children method
    	sup.onmouseover = function(event) {
    		$('.footnoteTip').remove();
    		var pTip = document.createElement('div');
    		pTip.className = 'footnoteTip';		// CSS
    		pTip.innerHTML = rmLastElm(document.getElementById($fRef[i].getAttribute("href").substring(1)).innerHTML,"a");
    		document.body.appendChild(pTip);

    		var posLeft = event.pageX - 180;
    		if (posLeft<0) posLeft = 20;
    		var posTop = event.pageY + 20;
    		var od = $('.footnoteTip');
    		var oH = od.outerHeight();
    		var oW = od.outerWidth();
    		if(posTop + oH - window.pageYOffset > $(window).height()) 	posTop = posTop - oH -40;
    		if (posLeft + oW > $(window).width()) posLeft = $(window).width() - oW -20;	//NexT.Mist pageXOffset=0
    		pTip.style.left = posLeft + 'px';
    		pTip.style.top = posTop + 'px';

    	};

    	sup.onmouseout = function(event) {
    		$('.footnoteTip').remove();
    	};
    }
    ```

## 外链播放器

also with wrong render with Hexo note label {% centerquote %}阅读榜Top 30{% endcenterquote %}

  • with npm install hexo-renderer-pandoc@0.2.4 --save or higher
Administrator@DESKTOP-ALEX MINGW64 /f/alex/hexo (gh-pages)
$ hexo clean && hexo g && hexo s
INFO  Deleted database.
INFO  Deleted public folder.
INFO  Start processing
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: write EOF
    at WriteWrap.afterWrite [as oncomplete] (net.js:868:14)

  1. regarding to your comment "IDK which is related". Perhaps that means you picked among the current two open issues and reported your issue as a comment to this one? Seems to me the proper way is to submit your own issue report, so we can track it properly.

  2. At a glance I see a few things:

    1. even with 0.2.3 + pandoc 2.7.1 windows x86_64, the two fenced code blocks failed to render. To confirm, is this intended by you or not?
    2. cal you elaborate a bit more on what is wrong with {% centerquote %}阅读榜Top 30{% endcenterquote %}? This does not appear in your posted .md file nor the output.
    3. with 0.2.4 or higher, I have never seen this issue before while I was using 0.2.6 with pandoc 2.6. I will try my best to replicate the issue. If you are willing to provide a minimal case to replicate the issue, that would help me a lot.

Now it is during the wee hours at my place. I will begin looking into this the next day.

Also I noticed that your first language is probably Chinese. If you believe communicating in Chinese is more beneficial for you to express yourself, I would not mind using Chinese and write a short abstract in English once your issue is resolved, provided we discus the matter properly in a separated issue.

嗯,忘记改版本号了。重新提了issue。感谢哟