fix(markdown): print auto-link as-is (#3032)
This commit is contained in:
1 parent
5c789b2dfc
commit
c4118edbe7
5 files changed
+27
-13
No files matched your search
+11
-3
@@ -104,9 +104,11 @@ function genericPrint(path, options, print) {
|
||||
]);
|
||||
}
|
||||
case "link":
|
||||
return options.originalText[node.position.start.offset] === "<"
|
||||
? concat(["<", node.url, ">"])
|
||||
: concat([
|
||||
switch (options.originalText[node.position.start.offset]) {
|
||||
case "<":
|
||||
return concat(["<", node.url, ">"]);
|
||||
case "[":
|
||||
return concat([
|
||||
"[",
|
||||
printChildren(path, options, print),
|
||||
"](",
|
||||
@@ -114,6 +116,12 @@ function genericPrint(path, options, print) {
|
||||
node.title ? ` ${printTitle(node.title)}` : "",
|
||||
")"
|
||||
]);
|
||||
default:
|
||||
return options.originalText.slice(
|
||||
node.position.start.offset,
|
||||
node.position.end.offset
|
||||
);
|
||||
}
|
||||
case "image":
|
||||
return concat([
|
||||
" for more info.
|
||||
|
||||
See
|
||||
[https://github.com/okonet/lint-staged#configuration](https://github.com/okonet/lint-staged#configuration)
|
||||
for more details about how you can configure lint-staged.
|
||||
See https://github.com/okonet/lint-staged#configuration for more details about
|
||||
how you can configure lint-staged.
|
||||
|
||||
##### Option 2. [pre-commit](https://github.com/pre-commit/pre-commit)
|
||||
|
||||
@@ -1834,8 +1833,7 @@ section.
|
||||
### Configuration Schema
|
||||
|
||||
If you'd like a JSON schema to validate your configuration, one is available
|
||||
here:
|
||||
[http://json.schemastore.org/prettierrc](http://json.schemastore.org/prettierrc).
|
||||
here: http://json.schemastore.org/prettierrc.
|
||||
|
||||
## Editor Integration
|
||||
|
||||
|
||||
@@ -20,3 +20,10 @@ exports[`title.md 1`] = `
|
||||
[hello](#world "title")
|
||||
|
||||
`;
|
||||
|
||||
exports[`url.md 1`] = `
|
||||
https://www.example.com/
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
https://www.example.com/
|
||||
|
||||
`;
|
||||
@@ -0,0 +1 @@
|
||||
https://www.example.com/
|
||||
@@ -4466,14 +4466,14 @@ _a \`_\`_
|
||||
exports[`example-452.md 1`] = `
|
||||
**a<http://foo.bar/?q=**>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
**a<[http://foo.bar/?q=](http://foo.bar/?q=)**>
|
||||
**a<http://foo.bar/?q=**>
|
||||
|
||||
`;
|
||||
|
||||
exports[`example-453.md 1`] = `
|
||||
__a<http://foo.bar/?q=__>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
**a<[http://foo.bar/?q=](http://foo.bar/?q=)**>
|
||||
**a<http://foo.bar/?q=**>
|
||||
|
||||
`;
|
||||
|
||||
@@ -5514,7 +5514,7 @@ exports[`example-564.md 1`] = `
|
||||
exports[`example-565.md 1`] = `
|
||||
<http://foo.bar/baz bim>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<[http://foo.bar/baz](http://foo.bar/baz) bim>
|
||||
<http://foo.bar/baz bim>
|
||||
|
||||
`;
|
||||
|
||||
@@ -5556,7 +5556,7 @@ exports[`example-570.md 1`] = `
|
||||
exports[`example-571.md 1`] = `
|
||||
< http://foo.bar >
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
< [http://foo.bar](http://foo.bar) >
|
||||
< http://foo.bar >
|
||||
|
||||
`;
|
||||
|
||||
@@ -5577,7 +5577,7 @@ exports[`example-573.md 1`] = `
|
||||
exports[`example-574.md 1`] = `
|
||||
http://example.com
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[http://example.com](http://example.com)
|
||||
http://example.com
|
||||
|
||||
`;
|
||||
|
||||
|
||||
Reference in new issue
Block a user