Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ampl converts your markdown files into AMP-compliant html so they can be cached by google for the fastest possible page load
Ampl transforms your Markdown into AMP-compliant html so it loads super-fast!
Google is putting their clout behind the AMP (Accelerated Mobile Pages) Project to help speed up page load times on the Mobile Web: https://googleblog.blogspot.co.uk/2015/10/introducing-accelerated-mobile-pages.html
This module lets you convert Markdown (.md
) files to AMP-compliant .html
so that you can serve them up to mobile clients much faster.
For many, reading on the mobile web is a slow, clunky and frustrating experience - but it doesn’t have to be that way. The Accelerated Mobile Pages (AMP) Project is an open source initiative that embodies the vision that publishers can create mobile optimized content once and have it load instantly everywhere.
The best place to understand how AMP works is on the official "How it Works" page: https://www.ampproject.org/how-it-works/
ampl
from NPMFirst install the module from npm:
npm install ampl --save
ampl.parse
in your codeThen in your ES5 code:
var ampl = require('ampl');
var markdownString = '# Hello World!'; // or read from a .md file
var cssStyle = 'h1 { color: green; }'; // or load your style.css file
ampl.parse(markdownString, {style: cssStyle}, function(ampHtml) {
console.log(ampHtml);
});
Alternatively, if you are already using ES6 in your project, write:
import { parse } from 'ampl';
const markdownString = '# Hello World!'; // or read from a .md file
const cssStyle = 'h1 { color: green; }'; // or load your style.css file
parse(markdownString, cssStyle, function(ampHtml) {
console.log(ampHtml);
});
This simple example is in example/simple.js
To run this example, execute the following command in your terminal:
./node_modules/babel-cli/bin/babel-node.js example/simple.js
This will output the following AMP-Compliant html
:
<html amp>
<head >
<meta charset='utf-8'></meta>
<link rel='canonical' href='default.html'></link>
<meta name='viewport' content='width=device-width,minimum-scale=1,initial-scale=1'></meta>
<style amp-custom>
h1 { color: green; }
</style>
<style >body {opacity: 0}</style><noscript ><style >body {opacity: 1}</style></noscript>
<script async src='https://cdn.ampproject.org/v0.js'></script>
<title >Index</title>
</head>
<div class="wrapper-main">
<body >
<h1 >Hello World!</h1>
</body>
</div>
</html>
When viewed in a Browser:
More elaborate example to follow...
ampl.parse
markdown
- (required) markdown string to be parsedoptions
- (required)
headOverride
- (optional) custom html head to use if you do not want to use one generated by ampl. Using this option will mean other options will have no effectstyle
- (optional) css string to style the output htmltitle
- (optional) sets the title property in the pagecanonicalUrl
- (optional) sets the canonicalUrl of the pageextraHeadHTML
- (optional) extra html to be inserted into the bottom of the headcallback(res)
- callback function with
res
- a string constaining html string for ampl pageampl.markdown2AmpHTML
options
- (required)
markdown
- (required) markdown string to be parsedcallback(res)
- callback function with
res
- a string constaining html string for ampl pageIf you have any questions please ask: https://github.com/dwyl/ampl/issues
FAQs
ampl converts your markdown files into AMP-compliant html so they can be cached by google for the fastest possible page load
The npm package ampl receives a total of 2 weekly downloads. As such, ampl popularity was classified as not popular.
We found that ampl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.