I’d like to customize the way posts are rendered on my hosted Discourse instance. For example, if I wanted to link stock symbols that start with a dollar sign (“cashtags”) like $AAPL, how would I do this?
You would need to write a plugin that would scan the post content for /\$(\w+)\b/ and replace it with a link to the corresponding stock.
Note: if you are hosted with us, we only allow custom plugin on the enterprise data plan.
「いいね!」 5
Where would they link to?
興味深いですね。
最も良いのはヤフーファイナンスでしょうか?
あるいはFinviz.comやBarchart.comはどうでしょう?
この機能を持つプラグインがあれば素晴らしいのですが。
「いいね!」 2
シンボルを入力した後、ライブ価格を追加することはできますか?価格の変動に応じて、緑または赤で条件付き書式を適用することも可能でしょうか。
例
$APPL $148.70
カスタムテーマコンポーネントを使用し、Discourse API の decorateCookedElement を活用することで実現可能です。株式情報を取得するためにサードパーティのサービスにリクエストを送信し、その結果を取り込む必要があります。
「いいね!」 4
@awesomerobot ありがとうございます。これについて調査いたします。
「いいね!」 1
まずは、Custom Mentionables - プラグイン - Discourse Meta をご覧になることをお勧めします(ただし、データセットの作成は別途必要です)。
「いいね!」 2