mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Add trailing dots to page.description when longer than 300 characters
This commit is contained in:
+5
-1
@@ -185,7 +185,11 @@ HTMLPipeline.prototype.applyAnnotations = function() {
|
||||
// This can totally be improved
|
||||
HTMLPipeline.prototype.extractDescription = function() {
|
||||
var $p = this.$('p');
|
||||
var description = $p.text().trim().slice(0, 300);
|
||||
|
||||
var description = $p.text().trim();
|
||||
if (description.length > 300) {
|
||||
description = description.slice(0, 300).trim()+'...';
|
||||
}
|
||||
|
||||
this.opts.onDescription(description);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user