Skip to content

superzhangzl/blog-note

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

备份一下博客里面用到的文章,万一那天丢失了还能恢复一下。顺便提供一个图床用。

下面这是按照我的编辑习惯,替换markdown里面用相对路径引用的文章,导出后直接复制到博客的编辑器里

public static void main(String[] args) throws IOException {
        // 项目的根路径
        String title = "https://github.com/superzhangzl/Essential-Image-Optimization-translation/tree/master/";
        // 输入文件
        String inputFile = "...";
        // 输出文件路径
        String outputFile = "...";
        Stream<String> lines = Files.lines(Paths.get(inputFile));
        String pages = lines
                .map(line -> {
                    if (line.matches("!\\[.*\\]\\(.*\\)")) {
                        System.out.println(line);
                        if (line.matches("!\\[.*\\]\\(\\./.*\\)")) {
                            line = line.replace("./", "/");
                        }
                        String newLine = line.replace("(", "(" + title)
                                .replace(")", "?raw=true)")
                                .replace("/tree/", "/blob/");
                        System.out.println(">> " + newLine);
                        return newLine;
                    } else {
                        return line;
                    }
                })
                .collect(Collectors.joining("\n"));
        // util 工具,要是没导入jar包重新写一个就是了
        FileUtils.write(new File(outputFile), pages, "UTF-8");
    }

About

用于备份一些笔记

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published