Bladeren bron

Headers section styling

NGPixel 8 jaren geleden
bovenliggende
commit
63f1ec30b4
5 gewijzigde bestanden met toevoegingen van 24 en 4 verwijderingen
  1. 0 0
      assets/css/app.css
  2. 0 0
      assets/css/error.css
  3. 21 1
      libs/markdown.js
  4. 2 2
      views/error-forbidden.pug
  5. 1 1
      views/error-notexist.pug

File diff suppressed because it is too large
+ 0 - 0
assets/css/app.css


File diff suppressed because it is too large
+ 0 - 0
assets/css/error.css


+ 21 - 1
libs/markdown.js

@@ -177,13 +177,33 @@ const parseContent = (content)  => {
 		if(cr(elm).children().length > 0) {
 			let bqLastChild = cr(elm).children().last()[0];
 			let bqLastChildClasses = cr(bqLastChild).attr('class');
-			if(bqLastChildClasses.length > 0) {
+			if(bqLastChildClasses && bqLastChildClasses.length > 0) {
 				cr(bqLastChild).removeAttr('class');
 				cr(elm).addClass(bqLastChildClasses);
 			}
 		}
 	});
 
+	//-> Enclose content below headers
+
+	cr('h2').each((i, elm) => {
+		let subH2Content = cr(elm).nextUntil('h1, h2');
+		cr(elm).after('<div class="indent-h2"></div>');
+		let subH2Container = cr(elm).next('.indent-h2');
+		_.forEach(subH2Content, (ch) => {
+			cr(subH2Container).append(ch);
+		});
+	});
+
+	cr('h3').each((i, elm) => {
+		let subH3Content = cr(elm).nextUntil('h1, h2, h3');
+		cr(elm).after('<div class="indent-h3"></div>');
+		let subH3Container = cr(elm).next('.indent-h3');
+		_.forEach(subH3Content, (ch) => {
+			cr(subH3Container).append(ch);
+		});
+	});
+
 	output = cr.html();
 
 	return output;

+ 2 - 2
views/error-forbidden.pug

@@ -24,6 +24,6 @@ html
 	body(class='is-forbidden')
 		.container
 			a(href='/'): img(src='/favicons/android-icon-96x96.png')
-			h1.title(style={ 'margin-top': '30px'}) Forbidden
-			h2.subtitle(style={ 'margin-bottom': '50px'}) Sorry, you don't have the necessary permissions to access this page.
+			h1 Forbidden
+			h2 Sorry, you don't have the necessary permissions to access this page.
 			a.button.is-amber.is-inverted(href='/') Go Home

+ 1 - 1
views/error-notexist.pug

@@ -26,5 +26,5 @@ html
 			a(href='/'): img(src='/favicons/android-icon-96x96.png')
 			h1= message
 			h2 Would you like to create this entry?
-			a.button.is-amber.is-inverted(href='/create/' + newpath) Create
+			a.button.is-amber.is-inverted.is-featured(href='/create/' + newpath) Create
 			a.button.is-amber.is-inverted(href='/') Go Home

Some files were not shown because too many files changed in this diff