Selaa lähdekoodia

Merge pull request #3358 from azat-archive/markdown-fix

Correctly strip leading white-space from markdown
Hakim El Hattab 2 vuotta sitten
vanhempi
commit
0c9bdeab70
3 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 0 0
      plugin/markdown/markdown.esm.js
  2. 0 0
      plugin/markdown/markdown.js
  3. 2 2
      plugin/markdown/plugin.js

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
plugin/markdown/markdown.esm.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
plugin/markdown/markdown.js


+ 2 - 2
plugin/markdown/plugin.js

@@ -47,10 +47,10 @@ const Plugin = () => {
 			leadingTabs = text.match( /^\n?(\t*)/ )[1].length;
 
 		if( leadingTabs > 0 ) {
-			text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
+			text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}(.*)','g'), function(m, p1) { return '\n' + p1 ; } );
 		}
 		else if( leadingWs > 1 ) {
-			text = text.replace( new RegExp('\\n? {' + leadingWs + '}', 'g'), '\n' );
+			text = text.replace( new RegExp('\\n? {' + leadingWs + '}(.*)', 'g'), function(m, p1) { return '\n' + p1 ; } );
 		}
 
 		return text;

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä