My markdown extension works in preview but not on cooked

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?

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?

Thank you for the reply Rafael.

The plugin’s code is here:

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 (Files · master · Text Blaze / Discourse Snippets · GitLab) doesn’t import anything.

I think this is simple naming issue due to:

Move it from markdown-it to the discourse-markdown directory.

That fixed it. Thank you Sam.

펜스 렌더러(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">Copy and paste this code into n8n to play with the workflow</div>' +
               tokens[idx].content +
             '</div>'
    };
  });

}

완전한 플러그인 구조는 여기에서 확인하실 수 있습니다. 도움을 주시면 감사하겠습니다!

혹시 성공한 적 있으신가요?

제 경우에는 파일이 올바른 폴더 /assets/javascripts/discourse-markdown에 있지만, 여전히 미리보기에서만 표시됩니다.

다른 몇몇 사용자는 시간이 지나고 나서 작동하기 시작했다고 해서, 서버를 재시작한 것 같다는 생각이 듭니다. 저도 그렇게 해봤지만 여전히 안 됩니다.