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

literate-ts

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

literate-ts - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

src/test/inputs/commented-sample.asciidoc

2

package.json
{
"name": "literate-ts",
"version": "1.0.1",
"version": "1.1.0",
"description": "Code samples that scale",

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

@@ -138,2 +138,6 @@ # literate-ts

You may also use `// #id` or `// verifier:directive` as an alternative form.
This is primarily useful if you want to prepend a code sample that's hidden inside an
HTML comment.
See below for a complete list of directives.

@@ -140,0 +144,0 @@

@@ -6,2 +6,4 @@ import {matchAndExtract} from './utils';

const EXTRACT_DIRECTIVE = /<!-- verifier:(.*) -->/;
const ALT_EXTRACT_ID = /^\/\/ #([^ ]+)$/;
const ALT_EXTRACT_DIRECTIVE = /^\/\/ verifier:(.*)$/;
const TOP_HEADER = /^#{1,3} (.*)$/;

@@ -14,5 +16,6 @@

const line = lines[i];
const id = matchAndExtract(EXTRACT_ID, line);
const id = matchAndExtract(EXTRACT_ID, line) || matchAndExtract(ALT_EXTRACT_ID, line);
const header = matchAndExtract(TOP_HEADER, line);
const directive = matchAndExtract(EXTRACT_DIRECTIVE, line);
const directive =
matchAndExtract(EXTRACT_DIRECTIVE, line) || matchAndExtract(ALT_EXTRACT_DIRECTIVE, line);

@@ -19,0 +22,0 @@ if (id) {

import fs from 'fs';
import glob from 'glob';
import path from 'path';

@@ -80,15 +82,7 @@ import {dedent} from '../utils';

test('snapshot', () => {
const dir = './src/test/inputs';
const inputFiles = glob.sync('./src/test/inputs/*.asciidoc');
// TODO(danvk): use a glob here
const inputs = ['doc1', 'noid', 'prepend', 'prepend-multiple', 'skip', 'multilinetype'];
for (const input of inputs) {
expect(
extractSamples(
fs.readFileSync(`${dir}/${input}.asciidoc`, 'utf8'),
input,
`${input}.asciidoc`,
),
).toMatchSnapshot(input);
for (const inputFile of inputFiles) {
const {base, name} = path.parse(inputFile);
expect(extractSamples(fs.readFileSync(inputFile, 'utf8'), name, base)).toMatchSnapshot(name);
}

@@ -95,0 +89,0 @@ });

import fs from 'fs';
import glob from 'glob';
import path from 'path';

@@ -7,13 +9,9 @@ import {extractSamples} from '../code-sample';

it('should match snapshots', () => {
const dir = './src/test/inputs';
const inputFiles = glob.sync('./src/test/inputs/*.md');
// TODO(danvk): use a glob here
const inputs = ['doc1', 'noid', 'prepend', 'prepend-multiple', 'skip', 'multilinetype'];
for (const input of inputs) {
expect(
extractSamples(fs.readFileSync(`${dir}/${input}.md`, 'utf8'), input, `${input}.md`),
).toMatchSnapshot(input);
for (const inputFile of inputFiles) {
const {base, name} = path.parse(inputFile);
expect(extractSamples(fs.readFileSync(inputFile, 'utf8'), name, base)).toMatchSnapshot(name);
}
});
});

Sorry, the diff of this file is not supported yet

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