Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pacmak/python): escape character escapes in python docs #2138

Merged
merged 8 commits into from Oct 22, 2020
2 changes: 1 addition & 1 deletion packages/jsii-pacmak/lib/markdown.ts
Expand Up @@ -20,7 +20,7 @@ export function md2rst(text: string) {
}

function textOf(node: commonmark.Node) {
return node.literal ?? '';
return node.literal?.replace(/\\([a-zA-Z])/, '\\\\$1') ?? '';
}

pump(ast, {
Expand Down
11 changes: 11 additions & 0 deletions packages/jsii-pacmak/test/python.test.ts
Expand Up @@ -113,6 +113,17 @@ test('list with multiline text', () => {
);
});

test('escape character escaping', () => {
converts(
[
'For example, if you specify \\N, BigQuery interprets \\N as a null value',
jsteinich marked this conversation as resolved.
Show resolved Hide resolved
],
[
'For example, if you specify \\N, BigQuery interprets \\N as a null value',
],
);
});

function converts(input: string[], output: string[]) {
const converted = md2rst(input.join('\n'));

Expand Down