scottf
2019 年 2 月 6 日午後 12:20
1
I have followed these instructions to create a Block BBCode markdown extension for Discourse.
The plugin works when previewing and editing a topic. However, when I actually post the Topic, the raw BBCode mark up appears in the post completely unprocessed.
Is there something I need to do to make sure the plugin operates on posted topics?
Falco
(Falco)
2019 年 2 月 6 日午後 2:12
2
I’ve had this happen due to importing modules using Javascript import statement, and the differences in paths between the browser and the mini_racer.
Can you share your plugin code so we can help you to debug?
scottf
2019 年 2 月 6 日午後 2:32
3
Thank you for the reply Rafael.
The plugin’s code is here:
GitLab.com
As you can see it is very simple. I am using ES Module imports, but only for adding a button to the editing bar. The Markdown extension (https://gitlab.com/textblaze/discourse-snippets/blob/master/assets/javascripts/lib/markdown-it/snippets.js.es6 ) doesn’t import anything.
sam
(Sam Saffron)
2019 年 2 月 6 日午後 10:36
4
I think this is simple naming issue due to:
Move it from markdown-it to the discourse-markdown directory.
scottf
2019 年 2 月 7 日午前 7:33
5
That fixed it. Thank you Sam.
fence レンダラー (md.renderer.rules.fence) をオーバーライドしようとした際、私も同じ問題に直面しています。プレビューウィンドウでは正常に動作するのですが、投稿後はデフォルトの Discourse レンダリングが表示されてしまいます。
以下がコードです:
export function setup(helper) {
if (!helper.markdownIt) return;
helper.allowList(['div.embedded_workflow', 'div.embedded_tip']);
helper.registerPlugin((md) => {
md.renderer.rules.fence = function (tokens, idx, options, env, slf) {
let content = tokens[idx].content;
return '<div class="embedded_workflow">' +
'<div class="embedded_tip">このコードを n8n にコピー&ペーストしてワークフローを試してみてください</div>' +
tokens[idx].content +
'</div>'
};
});
}
フルなプラグイン構造はこちら でご確認いただけます。ご協力をいただければ幸いです!
carkod
2022 年 12 月 9 日午後 11:13
7
機能したことはありますか?
私の場合は、正しいフォルダ /assets/javascripts/discourse-markdown にありますが、プレビューにしか表示されません。
他の人の中には、しばらくすると機能したという人もいますが、それはサーバーをリロードしたからだと思います。私もそうしましたが、うまくいきませんでした。