# \#code

**URL:** https://meta.discourse.org/tag/code/819.md

[Latest](https://meta.discourse.org/latest.md) · [Categories](https://meta.discourse.org/categories.md) · [Tags](https://meta.discourse.org/tags.md)

---

## [Developer's guide to Markdown extensions](https://meta.discourse.org/t/developers-guide-to-markdown-extensions/66023)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 1\
**Last updated:** [June 1, 2026, 8:45am UTC](https://meta.discourse.org/t/developers-guide-to-markdown-extensions/66023 "2026-06-01T08:45:53Z")

</div>

Discourse uses a Markdown engine called Markdown-it. Here are some dev notes that will help you either fix bugs in core or create your new plugins. The Basics Discourse only contains a few helpers on top of the engine,…

---

## [Using the DModal API to render Modal windows (aka popups/dialogs) in Discourse](https://meta.discourse.org/t/using-the-dmodal-api-to-render-modal-windows-aka-popups-dialogs-in-discourse/268304)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 0\
**Last updated:** [July 3, 2023, 9:52am UTC](https://meta.discourse.org/t/using-the-dmodal-api-to-render-modal-windows-aka-popups-dialogs-in-discourse/268304 "2023-07-03T09:52:06Z")

</div>

Discourse 3.1.0.beta6 ships with a brand new \<DModal\> component-based API. DModal is part of the UI kit and is imported from discourse/ui-kit/d-modal. :information\_source: This supersedes the old controller-based API, …

---

## [Using Plugin Outlet Connectors from a Theme or Plugin](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 12\
**Last updated:** [October 14, 2024, 10:37am UTC](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727 "2024-10-14T10:37:16Z")

</div>

Discourse includes hundreds of Plugin Outlets which can be used to inject new content or replace existing contend in the Discourse UI. ‘Outlet arguments’ are made available so that content can be customized based on the …

---

## [Using the JS API](https://meta.discourse.org/t/using-the-js-api/41281)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 18\
**Last updated:** [January 30, 2026, 7:30am UTC](https://meta.discourse.org/t/using-the-js-api/41281 "2026-01-30T07:30:33Z")

</div>

Discourse’s JavaScript API allows themes and plugins to make extensive customizations to the user experience. The simplest way to use it is to create a new theme from the admin panel, click “Edit Code”, and then head to …

---

## [Converting modals from legacy controllers to new DModal component API](https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 9\
**Last updated:** [November 7, 2023, 5:05pm UTC](https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057 "2023-11-07T17:05:46Z")

</div>

:information\_source: If you’re implementing a new Modal, check out the main docs here. This topic describes how to migrate an existing controller-based Modal to the new Component-based API. In the past, Discourse used…

---

## [Setup Continuous Integration using GitHub Actions](https://meta.discourse.org/t/setup-continuous-integration-using-github-actions/240150)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 8\
**Last updated:** [March 3, 2025, 9:12am UTC](https://meta.discourse.org/t/setup-continuous-integration-using-github-actions/240150 "2025-03-03T09:12:26Z")

</div>

:mag: Overview To build a robust extension for Discourse, it can be wise to include Continuous Integration (CI) into your plugin or theme-component. This will help to detect errors early on and lessen the chances of bugs…

---

## [Using Google's 'tachometer' to measure JS performance changes in Discourse](https://meta.discourse.org/t/using-googles-tachometer-to-measure-js-performance-changes-in-discourse/281158)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 0\
**Last updated:** [October 5, 2023, 1:57pm UTC](https://meta.discourse.org/t/using-googles-tachometer-to-measure-js-performance-changes-in-discourse/281158 "2023-10-05T13:57:29Z")

</div>

When working on client-side work in Discourse core/plugins/themes, it’s important to consider the performance impact. Google’s ‘Tachometer’ project provides a statistically rigorous benchmarking tool which we can use to …

---

## [Ember object ownership (getOwner, service injections, etc.)](https://meta.discourse.org/t/ember-object-ownership-getowner-service-injections-etc/292080)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 0\
**Last updated:** [January 19, 2024, 1:28pm UTC](https://meta.discourse.org/t/ember-object-ownership-getowner-service-injections-etc/292080 "2024-01-19T13:28:42Z")

</div>

:warning: Importing getOwner from discourse-common/lib/get-owner is deprecated. To access e.g. services there a couple of methods at your disposal. In components/controllers/routes you should use service injections …

---

## [How to run Discourse core, plugin and theme QUnit test suites](https://meta.discourse.org/t/how-to-run-discourse-core-plugin-and-theme-qunit-test-suites/66857)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 0\
**Last updated:** [July 26, 2017, 2:09pm UTC](https://meta.discourse.org/t/how-to-run-discourse-core-plugin-and-theme-qunit-test-suites/66857 "2017-07-26T14:09:58Z")

</div>

Discourse has extensive frontend tests for core, plugins and themes. Once you have a functioning local development environment, those tests can be run locally in a number of different ways. Running tests in the browser C…

---

## [Write acceptance tests and component tests for Ember code in Discourse](https://meta.discourse.org/t/write-acceptance-tests-and-component-tests-for-ember-code-in-discourse/49167)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 3\
**Last updated:** [February 23, 2024, 12:42pm UTC](https://meta.discourse.org/t/write-acceptance-tests-and-component-tests-for-ember-code-in-discourse/49167 "2024-02-23T12:42:10Z")

</div>

Automated tests are a great way to protect your code against future regressions. Many people are familiar with how to do this in our Rails codebase with rspec, but the Javascript side can be somewhat of an enigma to some…

---

## [Automatically lint and format code before commits](https://meta.discourse.org/t/automatically-lint-and-format-code-before-commits/132947)

<div class="topic-metadata">

**Author:** [@Discourse](https://meta.discourse.org/u/Discourse)\
**Replies:** 0\
**Last updated:** [November 8, 2019, 5:16pm UTC](https://meta.discourse.org/t/automatically-lint-and-format-code-before-commits/132947 "2019-11-08T17:16:12Z")

</div>

Discourse uses lefthook for git hooks, and bin/lint as the main CLI entry point for running the same checks manually. If you are working in a local clone, install the hooks once: pnpm install pnpm lefthook install Aft…

---

## [About standardized guidelines for theme components](https://meta.discourse.org/t/about-standardized-guidelines-for-theme-components/410741)

<div class="topic-metadata">

**Author:** [@satonotdead](https://meta.discourse.org/u/satonotdead)\
**Replies:** 4\
**Last updated:** [August 23, 2026, 11:59pm UTC](https://meta.discourse.org/t/about-standardized-guidelines-for-theme-components/410741 "2026-08-23T23:59:21Z")

</div>

I never thought I’d do this, but here I am, editing CSS and JavaScript, and creating my first simple theme and plugin components. As I’ve read before (though I wasn’t quite ready — one need a certain foundation to get s…

---

## [Discourse OneCompiler Code Runner](https://meta.discourse.org/t/discourse-onecompiler-code-runner/395478)

<div class="topic-metadata">

**Author:** [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)\
**Replies:** 0\
**Last updated:** [February 8, 2026, 6:01pm UTC](https://meta.discourse.org/t/discourse-onecompiler-code-runner/395478 "2026-02-08T18:01:24Z")

</div>

:information\_source: Summary Run codeblock code with a OneCompiler embded :hammer\_and\_wrench: Repository GitHub - NateDhaliwal/Discourse-OneCompiler-Code-Runner · GitHub :question: Install Guide How to ins…

---

## [Pygments rather than highlight.js for syntax highlighting](https://meta.discourse.org/t/pygments-rather-than-highlight-js-for-syntax-highlighting/391544)

<div class="topic-metadata">

**Author:** [@dbitouze](https://meta.discourse.org/u/dbitouze)\
**Replies:** 4\
**Last updated:** [December 17, 2025, 1:59pm UTC](https://meta.discourse.org/t/pygments-rather-than-highlight-js-for-syntax-highlighting/391544 "2025-12-17T13:59:37Z")

</div>

For syntax highlighting, Discourse relies on highlight.js but Pygments looks richer. For instance, here is how looks a Python code: text = input('Type a number, and its factorial will be printed: ') n = int(text) if n \<…

---

## [Rich Text editor in topics breaks white-space characters in multiple ways](https://meta.discourse.org/t/rich-text-editor-in-topics-breaks-white-space-characters-in-multiple-ways/381027)

<div class="topic-metadata">

**Author:** [@rimelek](https://meta.discourse.org/u/rimelek)\
**Replies:** 4\
**Last updated:** [October 15, 2025, 1:11pm UTC](https://meta.discourse.org/t/rich-text-editor-in-topics-breaks-white-space-characters-in-multiple-ways/381027 "2025-10-15T13:11:44Z")

</div>

Hi All! In this topic, I will refer to other topics, but I believe I will describe a bigger issue than other reports mentioned. My test environment OS: MacOS 15.6.1 Browser: Google Chrome 139.0.7258.140 (Official Buil…

---

## [Code-block line numbers](https://meta.discourse.org/t/code-block-line-numbers/330130)

<div class="topic-metadata">

**Author:** [@Lilly](https://meta.discourse.org/u/Lilly)\
**Replies:** 18\
**Last updated:** [March 3, 2025, 6:41am UTC](https://meta.discourse.org/t/code-block-line-numbers/330130 "2025-03-03T06:41:00Z")

</div>

:information\_source: Summary Adds line numbers to multi-line code-blocks in posts :eyeglasses: Preview Preview on Discourse Theme Creator :hammer\_and\_wrench: Repository https://github.com/Lillinator/code-b…

---

## [Rebuild the forum using code?](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173)

<div class="topic-metadata">

**Author:** [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)\
**Replies:** 9\
**Last updated:** [February 15, 2025, 2:37am UTC](https://meta.discourse.org/t/rebuild-the-forum-using-code/352173 "2025-02-15T02:37:34Z")

</div>

I had a few random ideas that popped into my head, and one of them was a plugin to install plugins. That requires a forum rebuild. Is there a way to rebuild using Ruby? I really don’t want to try: p \`cd ../../\` p \`. /la…

---

## [Issue with Code Block Formatting in Discourse – Red Text and Unintended Highlighting](https://meta.discourse.org/t/issue-with-code-block-formatting-in-discourse-red-text-and-unintended-highlighting/321315)

<div class="topic-metadata">

**Author:** [@alex10](https://meta.discourse.org/u/alex10)\
**Replies:** 23\
**Last updated:** [August 13, 2024, 7:24pm UTC](https://meta.discourse.org/t/issue-with-code-block-formatting-in-discourse-red-text-and-unintended-highlighting/321315 "2024-08-13T19:24:13Z")

</div>

I’m encountering an issue with code block formatting in Discourse. When posting Python code, certain parts of the code (such as URLs and paths) are being highlighted in red or formatted unexpectedly, as shown in the scre…
