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

@markdoc/markdoc

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markdoc/markdoc - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

10

package.json
{
"name": "@markdoc/markdoc",
"author": "Ryan Paul",
"version": "0.2.1",
"version": "0.2.2",
"description": "A text markup language for documentation",

@@ -43,4 +43,8 @@ "main": "dist/index.js",

"peerDependenciesMeta": {
"@types/react": {"optional": true},
"react": {"optional": true}
"@types/react": {
"optional": true
},
"react": {
"optional": true
}
},

@@ -47,0 +51,0 @@ "devDependencies": {

@@ -24,3 +24,3 @@ import { diff } from 'jest-diff';

{% callout #id .class .class2 a="check" b={"e":{"with space": 5}} c=8 d=[1, "2",true] %}
{% callout #id .class .class2 a="check" b={"e":{"with space": 5}} c=8 d=[1, "2",true, null] %}
Markdoc is open-source—check out it's [source](http://github.com/markdoc/markdoc) to see how it works.

@@ -65,3 +65,3 @@ {% /callout %}

c=8
d=[1, "2", true] %}
d=[1, "2", true, null] %}
Markdoc is open-source—check out it's [source](http://github.com/markdoc/markdoc) to see how it works.

@@ -144,4 +144,12 @@ {% /callout %}

const source = `
\\* Asterisk
regular_word_with_underscores
\\* List item
\\> Blockquote
\\# Heading
\\### Heading
**/docs/\\***

@@ -622,2 +630,19 @@

it('lists with complex items', () => {
const source = `
* **One {% colspan=1 %}**
* **Two {% colspan=2 %}**
* **Three {% colspan=3 %}**
`;
const expected = `
- **One**{% colspan=1 %}
- **Two**{% colspan=2 %}
- **Three**{% colspan=3 %}
`;
check(source, expected);
stable(expected);
});
it('fences with block level tags', () => {

@@ -661,19 +686,2 @@ const source = `{% tab %}

it('complex lists', () => {
const source = `
* **One {% colspan=1 %}**
* **Two {% colspan=2 %}**
* **Three {% colspan=3 %}**
`;
const expected = `
- **One**{% colspan=1 %}
- **Two**{% colspan=2 %}
- **Three**{% colspan=3 %}
`;
check(source, expected);
stable(expected);
});
it('nested fences', () => {

@@ -693,2 +701,17 @@ const source = `

});
it('multi-paragraph blockquotes', () => {
const source = `
> Blockquote {% .class %}
>
> with two paragraphs`;
const expected = `
> Blockquote {% .class %}
>
> with two paragraphs
`;
check(source, expected);
stable(expected);
});
});

@@ -20,2 +20,4 @@ import Ast from './ast';

const WRAPPING_TYPES = ['strong', 'em', 's'];
const max = (a: number, b: number) => Math.max(a, b);

@@ -46,3 +48,3 @@ const increment = (o: Options, n = 2) => ({

if (v === null) {
return '';
return 'null';
}

@@ -200,14 +202,25 @@ if (Array.isArray(v)) {

const { content } = n.attributes;
if (Ast.isAst(content)) yield OPEN + SPACE;
yield* typeof content === 'string'
? escapeMarkdownCharacters(content, /[_*~]/g)
: formatValue(content, no);
if (Ast.isAst(content)) yield SPACE + CLOSE;
if (Ast.isAst(content)) {
yield OPEN + SPACE;
yield* formatValue(content, no);
yield SPACE + CLOSE;
} else {
if (o.parent && WRAPPING_TYPES.includes(o.parent.type)) {
// Escape **strong**, _em_, and ~~s~~
yield* escapeMarkdownCharacters(content, /[*_~]/g);
} else {
// Escape > blockquote, * list item, and heading
yield* escapeMarkdownCharacters(content, /^[*>#]/);
}
}
break;
}
case 'blockquote': {
yield NL;
yield indent;
yield '> ';
yield* trimStart(formatChildren(n, no));
const prefix = '>' + SPACE;
yield n.children
.map((child) => format(child, no).trimStart())
.map((d) => NL + indent + prefix + d)
.join(indent + prefix);
break;

@@ -240,3 +253,2 @@ }

yield indent;
// TODO use formatChildren once we can differentiate inline from block tags within fences
yield n.attributes.content.split(NL).join(NL + indent); // yield* formatChildren(n, no);

@@ -243,0 +255,0 @@ yield boundary;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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