New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexo-generator-amp

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-generator-amp - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

4

lib/eyeCatchVars.js

@@ -45,7 +45,7 @@

if(data.eyeCatchImage == "" || !data.eyeCatchImageProperty){
console.log("\u001b[31m[hexo-generator-amp] .md should contain image file and width height element. path: "+ "\u001b[0m" +data.source);
if(config.generator_amp.warningLog)console.log("\u001b[33m[hexo-generator-amp] (warning) .md should contain image file and width height element. path: "+ "\u001b[0m" +data.source);
isIncompleteProperty = true;
}
if( Number(imgWidth) < 696 ){
console.log("\u001b[31m[hexo-generator-amp] Images should be at least 696 pixels wide. path: "+"\u001b[0m"+data.source);
if(config.generator_amp.warningLog)console.log("\u001b[33m[hexo-generator-amp] (warning) Images should be at least 696 pixels wide. path: "+"\u001b[0m"+data.source);
isIncompleteProperty = true;

@@ -52,0 +52,0 @@ }

@@ -6,15 +6,32 @@ 'use strict';

var fs = require('fs');
var ampTmplSrc = pathFn.join(__dirname, '../amp.ejs');
var template = ejs.compile(fs.readFileSync(ampTmplSrc, 'utf8'), {filename:__dirname});
module.exports = function(locals){
var config = this.config;
var cssTxt = "";
var config = this.config;
var ampTmplSrc = pathFn.join(__dirname, '../amp.ejs');
var cssFilePath = pathFn.join(__dirname, '../sample-amp.css');
var template = "";
var templateDir = __dirname;
//------------------------------------
// import template file
//------------------------------------
if(config.generator_amp && config.generator_amp.templateFilePath){
ampTmplSrc = pathFn.join(process.env.PWD ,config.generator_amp.templateFilePath);
templateDir = process.env.PWD;
}
template = ejs.compile(fs.readFileSync(ampTmplSrc, 'utf8'), {filename:__dirname});
//------------------------------------
// import CSS file
//------------------------------------
if(config.generator_amp && config.generator_amp.cssFilePath){
var cssFilePath = pathFn.join(process.env.PWD ,config.generator_amp.cssFilePath);
var cssTxt = fs.readFileSync(cssFilePath, 'utf8');
cssTxt = cssTxt.replace(/\@charset\s\"(UTF\-8|utf\-8)\"\;/g,"").replace(/\!important/g,"").replace(/((?!\s|\;|\{).)*?zoom\:.*?;/g,"");
cssFilePath = pathFn.join(process.env.PWD ,config.generator_amp.cssFilePath);
}
var cssTxt = fs.readFileSync(cssFilePath, 'utf8');
cssTxt = cssTxt.replace(/\@charset\s\"(UTF\-8|utf\-8)\"\;/g,"").replace(/\!important/g,"").replace(/((?!\s|\;|\{).)*?zoom\:.*?;/g,"");
return locals.posts.map(function(post){

@@ -106,3 +123,3 @@

if(imgSrc == "" || imgWidth == "" || imgHeight == ""){
console.log("\u001b[31m[hexo-generator-amp] .md should contain image file and width height element. path: "+"\u001b[0m"+post.source);
if(config.generator_amp.warningLog)console.log("\u001b[33m[hexo-generator-amp] (warning) .md should contain image file and width height element. path: "+"\u001b[0m"+post.source);
}

@@ -109,0 +126,0 @@

{
"name": "hexo-generator-amp",
"version": "0.0.9",
"version": "0.1.0",
"main": "index",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -5,2 +5,3 @@ # hexo-generator-amp

Documents : [read me](p/published-hexo-generator-amp/)
DEMO : [HTML](https://tea3.github.io/p/hexo-markdown-notation/index.html) | [AMP HTML](https://tea3.github.io/p/hexo-markdown-notation/index.amp.html#development=1)

@@ -30,3 +31,19 @@

Please setting option.
``` yaml
generator_amp:
logo:
path: asset/your-logoForAmp.jpg
width: 300
height: 60
google_analytics: UA-123456789-1
substituteTitleImage:
path: asset/your-alt-image.jpg
width: 1024
height: 1024
warningLog: false
```
## Options

@@ -41,3 +58,4 @@

google_analytics: UA-123456789
cssFilePath: asset/your-css-file-for-AMP.css
cssFilePath: asset/your-css-file-for-AMP.css (optional)
templateFilePath: asset/your-ejs-file-for-AMP.ejs (optional)
substituteTitleImage:

@@ -47,13 +65,16 @@ path: asset/path-to-your-substitute-image.jpg

height: 600
warningLog: true
authorDetail:
authorReading: Your name description
authorReading: Your name description (optional)
avatar:
path: asset/path-to-your-avator.jpg
width: 150
height: 150
description: Self introduction
copyright_notice: The footer copyright notice
path: asset/path-to-your-avator.jpg (optional)
width: 150 (optional)
height: 150 (optional)
description: Self introduction (optional)
copyright_notice: The footer copyright notice (optional)
```
### generator_amp settings

@@ -64,6 +85,8 @@ - **logo.path**: File path of a your logo image.

- **google_analytics**: Your google analytics tracking ID.
- **cssFilePath**: File path of a your css file for AMP. (e.g. sample-amp.css)
- **cssFilePath(optional)**: File path of a your css file for AMP. (e.g. ./style-for-amp.css)
- **templateFilePath(optional)**: File path of a your template file for AMP. (e.g. ./tamplate-for-amp.ejs)
- **substituteTitleImage.path**: File path of a your substitute title image. (Use this when the image is not in the markdown)
- **substituteTitleImage.width**: Width of a your substitute title image. (width <= 600px)
- **substituteTitleImage.height**: Height of a your substitute title image. (height <= 60px)
- **warningLog**: Enabled warnings.

@@ -70,0 +93,0 @@ ### Auther detail settings (optional)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc