This repository was archived by the owner on Mar 15, 2023. It is now read-only.
File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,19 @@ block.paragraph = replace(block.paragraph)
64
64
( 'def' , block . def )
65
65
( ) ;
66
66
67
+ /**
68
+ * No Block Grammar
69
+ */
70
+
71
+ block . none = Object . keys ( block ) . reduce ( function ( obj , key ) {
72
+ if ( key === 'text' || key === '_tag' ) {
73
+ obj [ key ] = block [ key ] ;
74
+ } else {
75
+ obj [ key ] = noop ;
76
+ }
77
+ return obj ;
78
+ } , { } ) ;
79
+
67
80
/**
68
81
* Normal Block Grammar
69
82
*/
@@ -105,7 +118,9 @@ function Lexer(options) {
105
118
this . options = options || marked . defaults ;
106
119
this . rules = block . normal ;
107
120
108
- if ( this . options . gfm ) {
121
+ if ( this . options . inline ) {
122
+ this . rules = block . none ;
123
+ } else if ( this . options . gfm ) {
109
124
if ( this . options . tables ) {
110
125
this . rules = block . tables ;
111
126
} else {
@@ -1075,7 +1090,7 @@ Parser.prototype.tok = function() {
1075
1090
return this . renderer . paragraph ( this . inline . output ( this . token . text ) ) ;
1076
1091
}
1077
1092
case 'text' : {
1078
- return this . renderer . paragraph ( this . parseText ( ) ) ;
1093
+ return this . options . inline ? this . parseText ( ) : this . renderer . paragraph ( this . parseText ( ) ) ;
1079
1094
}
1080
1095
}
1081
1096
} ;
@@ -1240,6 +1255,7 @@ marked.setOptions = function(opt) {
1240
1255
marked . defaults = {
1241
1256
gfm : true ,
1242
1257
tables : true ,
1258
+ inline : false ,
1243
1259
breaks : false ,
1244
1260
pedantic : false ,
1245
1261
sanitize : false ,
You can’t perform that action at this time.
0 commit comments