Skip to main content

StackEdit

好用的雲端markdown編輯器 可以同時跟github檔案做同步 好棒棒 但缺點就是他會一直commit,這點就是要忽略這些就是了 但目前我的使用方式是,將這個編輯器連動到draft的branch,等更新到一個段落後再到github按下pr就好!

2021-11-11 但在跟版本庫同步時,因為github改版,所以token的位置有變,目前有大大給出一個解法 https://github.com/benweet/stackedit/issues/1755#issuecomment-918949789 只要在開發者工具中將這段內容附上並按下enter 再執行即可

window.XMLHttpRequest =  class MyXMLHttpRequest extends window.XMLHttpRequest {
open(...args){
if(args[1].startsWith("https://api.github.com/user?access_token=")) {
// apply fix as described by github
// https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/#changes-to-make

const segments = args[1].split("?");
args[1] = segments[0]; // remove query params from url
const token = segments[1].split("=")[1]; // save the token

const ret = super.open(...args);

this.setRequestHeader("Authorization", `token ${token}`); // set required header

return ret;
}
else {
return super.open(...args);
}
}
}