GithubHelp home page GithubHelp logo

utools-plugin-ruanyifeng's Introduction

自动生成utools插件

安装

cd utools-plugin-ruanyifeng
npm install

运行

npm run build <url> [publicDir]

# 参数说明
# url:  阮一峰的网络日志地址
# publicDir: 生成目录 可选 

示例

npm run build https://www.ruanyifeng.com/blog/2019/03/grid-layout-tutorial.html public

配置文件说明:

{
  "publicDir": {
    "root": "public", // 配置build目录
    "static": "static" // 配置build的静态文件目录
  },
  "indexes": {
    "root": "article", // 文章索引根节点,根据需要更改
    "title": "#page-title", // 页面标题 暂时没用
    "indexes": [
      {
        "selector": "h2" // 索引标题选择器 1
      },
      {
        "selector": "h3" // 索引标题选择器 1
      },
      ...
    ]
  },
  // 要移除的元素配置,可以根据完成语句移除,可以根据选择器移除
  "remove": { 
    "include": { // 需要移除的配置
      "statement": [
        "<link rel=\"start\" href=\"https://www.ruanyifeng.com/blog/\" title=\"Home\">",
        "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"Recent Entries\" href=\"https://feeds.feedburner.com/ruanyifeng\">"
      ],
      "element": [
        "#header",
        ".asset-header",
        "#related_entries",
        "#cre",
        "#comments",
        "#footer",
        "script",
        "iframe"
      ]
    },
    "exclude": { // 不需要移除的配置,优先级大于 include
      "statement": [
        "<script type=\"text/javascript\" src=\"https://www.ruanyifeng.com/blog/js/prism.js\"></script>"
      ],
      "element": []
    }
  }
}

模板文件说明

└─template
        features.icon.png      # 插件icon
        logo.png               # 插件logo
        plugin.template.txt    # 插件plugin.json模板,根据需要变更
        preload.template.txt   # 插件preload.js模板,根据需要变更

注意:

  1. 仅对阮一峰的网络日志有效
  2. 发布utools插件请注明原文作者
  3. 代码中使用cheerio解析HTML

utools-plugin-ruanyifeng's People

Contributors

liuxin2533 avatar

Watchers

 avatar

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.