@@ -241,7 +241,7 @@ const HEADING_SETEXT_R = /^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/
241
241
* ([^ >/]+)
242
242
*
243
243
* 3. Ignore a space after the starting tag and capture the attribute portion of the tag (capture 2)
244
- * ?([^>]*)\/{0} >
244
+ * ?([^>]*)>
245
245
*
246
246
* 4. Ensure a matching closing tag is present in the rest of the input string
247
247
* (?=[\s\S]*<\/\1>)
@@ -254,7 +254,7 @@ const HEADING_SETEXT_R = /^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/
254
254
* \n*
255
255
*/
256
256
const HTML_BLOCK_ELEMENT_R =
257
- / ^ * (? ! < [ a - z ] [ ^ > / ] * ? \/ > ) < ( [ a - z ] [ ^ > / ] * ) ? ( [ ^ > ] * ) \/ { 0 } > \n ? ( \s * (?: < \1[ ^ > ] * ?> [ \s \S ] * ?< \/ \1> | (? ! < \1) [ \s \S ] ) * ?) < \/ \1> \n * / i
257
+ / ^ * (? ! < [ a - z ] [ ^ > / ] * ? \/ > ) < ( [ a - z ] [ ^ > / ] * ) ? ( [ ^ > ] * ) > \n ? ( \s * (?: < \1[ ^ > ] * ?> [ \s \S ] * ?< \/ \1> | (? ! < \1) [ \s \S ] ) * ?) < \/ \1> \n * / i
258
258
259
259
const HTML_CHAR_CODE_R = / & ( [ a - z 0 - 9 ] + | # [ 0 - 9 ] { 1 , 6 } | # x [ 0 - 9 a - f A - F ] { 1 , 6 } ) ; / gi
260
260
@@ -716,9 +716,9 @@ function attributeValueToJSXPropValue(
716
716
717
717
// snake-case to camelCase
718
718
// also handles PascalCasing vendor prefixes
719
- const camelCasedKey = key . replace ( / ( - [ a - z ] ) / g , substr =>
720
- substr [ 1 ] . toUpperCase ( )
721
- )
719
+ const camelCasedKey = key
720
+ . trim ( )
721
+ . replace ( / ( - [ a - z ] ) / g , substr => substr [ 1 ] . toUpperCase ( ) )
722
722
723
723
// key.length + 1 to skip over the colon
724
724
styles [ camelCasedKey ] = kvPair . slice ( key . length + 1 ) . trim ( )
@@ -1456,6 +1456,7 @@ export function compiler(
1456
1456
order : Priority . HIGH ,
1457
1457
parse ( capture , parse , state ) {
1458
1458
const [ , whitespace ] = capture [ 3 ] . match ( HTML_LEFT_TRIM_AMOUNT_R )
1459
+
1459
1460
const trimmer = new RegExp ( `^${ whitespace } ` , 'gm' )
1460
1461
const trimmed = capture [ 3 ] . replace ( trimmer , '' )
1461
1462
@@ -1470,7 +1471,7 @@ export function compiler(
1470
1471
const ast = {
1471
1472
attrs : attrStringToMap ( capture [ 2 ] ) ,
1472
1473
noInnerParse : noInnerParse ,
1473
- tag : noInnerParse ? tagName : capture [ 1 ] ,
1474
+ tag : ( noInnerParse ? tagName : capture [ 1 ] ) . trim ( ) ,
1474
1475
} as {
1475
1476
attrs : ReturnType < typeof attrStringToMap >
1476
1477
children ?: ReturnType < MarkdownToJSX . NestedParser > | undefined
@@ -1513,7 +1514,7 @@ export function compiler(
1513
1514
parse ( capture /*, parse, state*/ ) {
1514
1515
return {
1515
1516
attrs : attrStringToMap ( capture [ 2 ] || '' ) ,
1516
- tag : capture [ 1 ] ,
1517
+ tag : capture [ 1 ] . trim ( ) ,
1517
1518
}
1518
1519
} ,
1519
1520
render ( node , output , state ) {
0 commit comments