
Product
Introducing Module Reachability: Focus on the Vulnerabilities That Matter
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Light Meta Language - an HTML alternative
<
, >
character, and no closing tag;
), comment (#
), cdata ($
)(click)="x = 'nah'"
) unlike Pug/Jade!DOCTYPE html
html
head
title ; My Title
script type="text/javascript" src="ext.js"
script type="text/javascript"
alert('Hello');
style
body { color: #333; }
body
# A comment
div id="wrapper"
; My Site!
Translates to
<!DOCTYPE html>
<html>
<head>
<title>
My Title
</title>
<script type="text/javascript" src="ext.js"></script>
<script type="text/javascript">
alert('Hello');
</script>
<style>
body { color: #333; }
</style>
</head>
<body>
<!-- A comment -->
<div id="wrapper">
My Site!
</div>
</body>
</html>
npm install lml --save
// convert LML to HTML
const parseLML = require('lml').parseLML;
parseLML(lmlString).toHTML();
Parser functions are exposed with the same signiture, and the returned object has the same interface:
parseAST(source: string | ASTModel[], parseConfig?: ParseConfig) => ParserInterface
parseJSON(source: string | JSONModel[], parseConfig?: ParseConfig) => ParserInterface
parseLML(source: string, parseConfig?: ParseConfig) => ParserInterface
npm install html-lml --save
parseHTML(source: string, parseConfig?: ParseConfig) => ParserInterface
Parser interface:
interface ParserInterface {
errors: ParseError[];
toAST(config?: OutputConfig): ASTModel[];
toHTML(config?: OutputConfig): string;
toJSON(config?: OutputConfig): JSONModel[];
toLML(config?: OutputConfig): string;
}
interface ParseConfig {
indentation?: string; // for parsing LML, if autodetection is not adequate
url?: string; // path to source file
}
interface OutputConfig {
indentation?: string;
lineWrap?: number;
minify?: boolean;
orderAttributes?: 'ascii' | 'natural' | 'angular'; // angular order means: <tag *ngXxx="x" any="x" [other]="x" prop="x" [(banana)]="box" (event)="e()" (handler)="e()" >
}
AST model is used by a variety of DOM parsers, like https://astexplorer.net/
interface ASTModel {
type: 'cdata' | 'comment' | 'directive' | 'script' | 'style' | 'tag' | 'text';
name?: string; // element (e.g. tag) name
data?: string; // value of comment, directive, and text
attribs?: {[name: string]: string};
children?: ASTModel[];
startIndex?: number;
endIndex?: number;
}
The native structure used by these libraries
interface JSONModel {
type: 'cdata' | 'comment' | 'directive' | 'element' | 'text';
name?: string; // element name
data?: string; // value of comment, directive, and text
attributes?: {name: string; value?: string}[];
children?: JSONModel[];
}
There is a dedicated command line tool: lml-cli
FAQs
Light Meta Language. A simple-yet-powerful HTML syntax alternative
We found that lml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
Research
Security News
Socket researchers uncovered malicious npm and PyPI packages that steal crypto wallet credentials using Google Analytics and Telegram for exfiltration.