Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
Simplify and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
timnew committed Apr 13, 2016
1 parent 80486da commit 7199637
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
2 changes: 0 additions & 2 deletions .npmignore
@@ -1,3 +1 @@
lib_src
node_modules
gulpfile.coffee
16 changes: 15 additions & 1 deletion index.js
@@ -1 +1,15 @@
module.exports = require('./lib')
// {% codepen userId|anonymous|anon slugHash theme [defaultTab [height [width]]] %}
function codepenTagRender(args) {
const userId = args[0] === 'anonymous' ? 'anon' : args[0];
const slugHash = args[1];
const theme = args[2];
const defaultTab = args[3] != null ? args[3] : 'result';
const height = args[4] != null ? args[4] : 300;
const width = args[5] != null ? args[5] : '100%';
const src = `//codepen.io/${userId}/embed/${slugHash}?height=${height}&theme-id=${theme}&slug-hash=${slugHash}&default-tab=${defaultTab}`;
const id = `cp_embed_${slugHash.replace(/\//g, '_')}`

return `<iframe id=${id} src=${src} scrolling="no" frameborder="no" height="${height}" allowTransparency="true" allowfullscreen="true" class="cp_embed_iframe" style=""width: ${width}; overflow: hidden;></iframe>`;
}

hexo.extend.tag.register('codepen', codepenTagRender);
15 changes: 0 additions & 15 deletions lib/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hexo-tag-codepen",
"version": "0.2.0",
"version": "0.2.1",
"description": "Hexo tag to embed code snippet from codepen.io",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 7199637

Please sign in to comment.