Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: allow advanced specification of excerpts for posts

Sam5c17e462744c
diff --git a/app/assets/javascripts/pretty-text/white-lister.js.es6 b/app/assets/javascripts/pretty-text/white-lister.js.es6
index c303283e360..f8641261da8 100644
--- a/app/assets/javascripts/pretty-text/white-lister.js.es6
+++ b/app/assets/javascripts/pretty-text/white-lister.js.es6
@@ -183,6 +183,7 @@ const DEFAULT_LIST = [
"small",
"span[lang]",
"span.excerpt",
+ "div.excerpt",
"span.hashtag",
"span.mention",
"strike",
diff --git a/spec/components/post_creator_spec.rb b/spec/components/post_creator_spec.rb
index 20f1e82b53f..304491c59cc 100644
--- a/spec/components/post_creator_spec.rb
+++ b/spec/components/post_creator_spec.rb
@@ -270,6 +270,21 @@ describe PostCreator do
}.to_not change { topic.excerpt }
end
+ it 'supports custom excerpts' do
+ raw = <<~MD
+ <div class='excerpt'>
+ I am
+
+ a custom excerpt
+ </div>
+
+ testing
+ MD
+ post = create_post(raw: raw)
+
+ expect(post.excerpt).to eq("I am\na custom excerpt")
+ end
+
it 'creates post stats' do
Draft.set(user, 'new_topic', 0, "test")