File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,6 @@ class SectionWidget extends WidgetType {
113113 }
114114}
115115
116- const mdCommentRe = / % % / g;
117116class SectionWordCountEditorPlugin implements PluginValue {
118117 decorations : DecorationSet ;
119118 lineCounts : any [ ] = [ ] ;
@@ -243,7 +242,11 @@ class SectionWordCountEditorPlugin implements PluginValue {
243242 const b = new RangeSetBuilder < Decoration > ( ) ;
244243 if ( ! plugin . settings . displaySectionCounts ) return b . finish ( ) ;
245244
245+ const tree = syntaxTree ( view . state ) ;
246246 const getHeaderLevel = ( line : Line ) => {
247+ const token = tree . resolve ( line . from , 1 ) ;
248+ if ( / c o d e - ? b l o c k | m a t h / . test ( token ?. type ?. name ) ) return null ;
249+
247250 const match = line . text . match ( / ^ ( # + ) [ \t ] / ) ;
248251 return match ? match [ 1 ] . length : null ;
249252 } ;
You can’t perform that action at this time.
0 commit comments