Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ecmarkdown

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecmarkdown - npm Package Compare versions

Comparing version 5.0.2 to 5.1.0

5

dist/emitter.js

@@ -80,3 +80,6 @@ "use strict";

emitListItem(li) {
this.str += '<li>';
let label = li.label === null
? ''
: ` id="${li.name === 'ordered-list-item' ? 'step' : 'item'}-${li.label}"`;
this.str += `<li${label}>`;
this.emitFragment(li.contents);

@@ -83,0 +86,0 @@ if (li.sublist !== null) {

@@ -66,2 +66,7 @@ export declare type Position = {

};
export declare type LabelToken = {
name: 'label';
value: string;
location?: LocationRange;
};
export declare type Token = EOFToken | FormatToken | ParabreakToken | LinebreakToken | WhitespaceToken | TextToken | CommentToken | TagToken | UnorderedListToken | OrderedListToken | OpaqueTagToken;

@@ -140,2 +145,3 @@ export declare type NotEOFToken = Exclude<Token, EOFToken>;

sublist: ListNode | null;
label: string | null;
location?: LocationRange;

@@ -147,2 +153,3 @@ };

sublist: ListNode | null;
label: string | null;
location?: LocationRange;

@@ -149,0 +156,0 @@ };

3

dist/parser.js

@@ -81,2 +81,3 @@ "use strict";

this._t.next();
const label = this._t.tryScanLabel();
const contents = this.parseFragment({ inList: true });

@@ -93,3 +94,3 @@ const listItemTok = this._t.peek();

let name = kind === 'ol' ? 'ordered-list-item' : 'unordered-list-item';
return this.finish({ name, contents, sublist });
return this.finish({ name, contents, sublist, label });
}

@@ -96,0 +97,0 @@ parseFragment(opts, closingFormatKind) {

@@ -23,2 +23,3 @@ import type { Token, Position } from './node-types';

tryScanComment(): string | undefined;
tryScanLabel(): string | null;
matchToken(): void;

@@ -25,0 +26,0 @@ getLocation(): Position;

@@ -5,2 +5,3 @@ "use strict";

const commentRegexp = /^<!--[\w\W]*?-->/;
const labelRegexp = /^\[label="([\w-]+)"] /;
const digitRegexp = /\d/;

@@ -142,2 +143,11 @@ const opaqueTags = new Set(['emu-grammar', 'emu-production', 'pre', 'code', 'script', 'style']);

}
// Label tokens are only valid immediately after list tokens, so we let this be called by the parser.
tryScanLabel() {
const match = this.str.slice(this.pos).match(labelRegexp);
if (!match) {
return null;
}
this.pos += match[0].length;
return match[1];
}
// Attempts to match any of the tokens at the given index of str

@@ -144,0 +154,0 @@ matchToken() {

{
"name": "ecmarkdown",
"version": "5.0.2",
"version": "5.1.0",
"description": "A compiler for \"Ecmarkdown\" algorithm shorthand into HTML.",

@@ -5,0 +5,0 @@ "main": "dist/ecmarkdown.js",

@@ -58,2 +58,4 @@ # Ecmarkdown

List items can be given a label by putting `[label="something"]` at the start of the item, as in `1. [label="something"]`. This will generate a `<li>` element with an id property of `step-something` or `item-something` for ordered and unordered lists respectively. This is used by Ecmarkup for referencing specific steps of Ecmarkdown algorithms.
#### HTML Blocks

@@ -60,0 +62,0 @@

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