├── .npmignore ├── index.js ├── README.md ├── package.json ├── .gitignore └── LICENSE /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const qrImage = require('qr-image') 2 | 3 | hexo.extend.helper.register('qrcode', function(url, option){ 4 | option = Object.assign({ 5 | size: 6, 6 | margin: 0 7 | }, option || {}) 8 | 9 | const buffer = qrImage.imageSync(url, { 10 | type: 'png', 11 | size: option.size, 12 | margin: option.margin 13 | }) 14 | return 'data:image/png;base64,' + buffer.toString('base64') 15 | }) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hexo-helper-qrcode 2 | QRcode for Hexo helper plugins. 3 | 4 | ## install 5 | 6 | ``` 7 | $ npm i -S hexo-helper-qrcode 8 | ``` 9 | 10 | ## useage 11 | 12 | ```html 13 | 14 | 15 | 16 | 19 | 20 | 21 | 24 | ``` 25 | 26 | 27 | ## license 28 | 29 | MIT 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hexo-helper-qrcode", 3 | "version": "1.0.2", 4 | "description": "QRcode for Hexo helper plugins.", 5 | "main": "index.js", 6 | "keywords": [ 7 | "hexo", 8 | "qrcode", 9 | "helper" 10 | ], 11 | "author": { 12 | "name": "yusen", 13 | "email": "634206017@qq.com" 14 | }, 15 | "license": "MIT", 16 | "dependencies": { 17 | "qr-image": "^3.1.0" 18 | }, 19 | "repository": { 20 | "url": "git+https://github.com/yscoder/hexo-helper-qrcode.git", 21 | "type": "git" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Yusen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------