Skip to content

Commit c0a7de1

Browse files
committed
FIX: Having a series of empty brackets would have markdown-js output
funky looking javascript `toString()` information.
1 parent 6e9c2eb commit c0a7de1

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/dialects/gruber.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,12 +682,14 @@ define(['../markdown_helpers', './dialect_helpers', '../parser'], function (Mark
682682
// [links][] uses links as its reference
683683
attrs = { ref: ( m[ 1 ] || String(children) ).toLowerCase(), original: orig.substr( 0, consumed ) };
684684

685-
link = [ "link_ref", attrs ].concat( children );
685+
if (children && children.length > 0) {
686+
link = [ "link_ref", attrs ].concat( children );
686687

687-
// We can't check if the reference is known here as it likely wont be
688-
// found till after. Check it in md tree->hmtl tree conversion.
689-
// Store the original so that conversion can revert if the ref isn't found.
690-
return [ consumed, link ];
688+
// We can't check if the reference is known here as it likely wont be
689+
// found till after. Check it in md tree->hmtl tree conversion.
690+
// Store the original so that conversion can revert if the ref isn't found.
691+
return [ consumed, link ];
692+
}
691693
}
692694

693695
// Another check for references
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
["html",
2+
["p", "[[][]"]
3+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[[][]

0 commit comments

Comments
 (0)