# Support Mojo syntax highlighting on this forum

**URL:** <https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161>\
**Category:** Forum Feedback\
**Created:** [December 10, 2024, 1:18am UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161 "2024-12-10T01:18:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristanbiesecker](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/tristanbiesecker/32/58_2.png) [@tristanbiesecker](https://forum.modular.com/u/tristanbiesecker)\
**Post date:** [December 10, 2024, 1:18am UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/1 "2024-12-10T01:18:51Z")

</div>

I know this forum is brand new, but would we be able to get Mojo syntax highlighting supported on this forum?

---

<div class="post-metadata">

**Author:** ![owenhilyard](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/owenhilyard/32/41_2.png) [@owenhilyard](https://forum.modular.com/u/owenhilyard)\
**Post date:** [December 10, 2024, 4:21am UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/2 "2024-12-10T04:21:12Z")

</div>

@Caroline That seems like a major omission, is this something that Modular could upstream from existing tooling?

---

<div class="post-metadata">

**Author:** ![DarinSimmons](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/darinsimmons/32/12_2.png) [@DarinSimmons](https://forum.modular.com/u/DarinSimmons)\
**Post date:** [December 10, 2024, 6:10am UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/3 "2024-12-10T06:10:42Z")

</div>

Welcome @tristanbiesecker . I do think that this is an important request not just for Discourse but Discord and Github. As I understand it, the supported language list in the [config file](https://github.com/discourse/discourse/blob/c4de8565eceeadda8f2a800226a02d0c40752ae6/config/site_settings.yml#L1086-L1087) is

```
default: "bash|c|cpp|csharp|css|diff|go|graphql|ini|java|javascript|json|kotlin|lua|makefile|markdown|objectivec|perl|php|php-template|plaintext|python|python-repl|r|ruby|rust|scss|shell|sql|swift|typescript|xml|yaml|wasm"

```

Adding `mojo` would be nice though I’m under the impression that it invokes `Highlightjs` and it does not currently support `mojo`

[https://highlightjs.readthedocs.io/en/latest/supported-languages.html](https://highlightjs.readthedocs.io/en/latest/supported-languages.html)

Like most markdown platforms, Discourse does support the triple tick + language in order to invoke the language formatting.

(Partly this is explanation, partly this is breadcrumbs for Caroline and/or whoever chooses to take this on.)

---

<div class="post-metadata">

**Author:** ![lesoup-mxd](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/lesoup-mxd/32/585_2.png) [@lesoup-mxd](https://forum.modular.com/u/lesoup-mxd)\
**Post date:** [December 10, 2024, 6:53am UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/4 "2024-12-10T06:53:08Z")

</div>

lets check the manual language specification.

```mojo
struct Shell:
    var path: String # shell path
    var args: String # additional arguments passed to the shell
    var env: List[String]
    var shellrc: String # shellrc file path

    fn __init__ (
        inout self,
        path: Optional[String],
        args: Optional[String],
        env: List[String],
        shellrc: Optional[String],
    ) -> None:
        self.path = path.value() if path is not None else ""
        self.args = args.value() if args is not None else ""
        self.env = List(str("")) # env
        self.shellrc = shellrc.value() if shellrc is not None else ""

    fn __copyinit__ (inout self, existing: Self) -> None:
        self.path = existing.path
        self.args = existing.args
        self.env = existing.env
        self.shellrc = existing.shellrc

    fn dump(self) -> None:
        print("Shell struct")
        print("Path: ", self.path)
        print("Args: ", self.args)

```

As we can see here, although i specified the language manually, no linting yet ☹

---

<div class="post-metadata">

**Author:** ![DarinSimmons](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/darinsimmons/32/12_2.png) [@DarinSimmons](https://forum.modular.com/u/DarinSimmons)\
**Post date:** [December 10, 2024, 5:18pm UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/5 "2024-12-10T17:18:27Z")

</div>

I’m not sure what language you asked for, this is your code that I started with

````python`

```python
struct Shell:
    var path: String # shell path
    var args: String # additional arguments passed to the shell
    var env: List[String]
    var shellrc: String # shellrc file path

    fn __init__ (
        inout self,
        path: Optional[String],
        args: Optional[String],
        env: List[String],
        shellrc: Optional[String],
    ) -> None:
        self.path = path.value() if path is not None else ""
        self.args = args.value() if args is not None else ""
        self.env = List(str("")) # env
        self.shellrc = shellrc.value() if shellrc is not None else ""

    fn __copyinit__ (inout self, existing: Self) -> None:
        self.path = existing.path
        self.args = existing.args
        self.env = existing.env
        self.shellrc = existing.shellrc

    fn dump(self) -> None:
        print("Shell struct")
        print("Path: ", self.path)
        print("Args: ", self.args)

```

So Discourse and Highlightsjs are active as seen by the color coordination. What output were you expecting and what language did you specify?

---

<div class="post-metadata">

**Author:** ![rcmpge](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/rcmpge/32/849_2.png) [@rcmpge](https://forum.modular.com/u/rcmpge)\
**Post date:** [December 10, 2024, 5:38pm UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/6 "2024-12-10T17:38:41Z")

</div>

Sheesh. Is there a linter and code formatting tool for Mojo in the works.

---

<div class="post-metadata">

**Author:** ![DarinSimmons](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/darinsimmons/32/12_2.png) [@DarinSimmons](https://forum.modular.com/u/DarinSimmons)\
**Post date:** [December 10, 2024, 6:24pm UTC](https://forum.modular.com/t/support-mojo-syntax-highlighting-on-this-forum/161/8 "2024-12-10T18:24:11Z")

</div>

The VSCode extension does code formatting and is wonderful. This is Discourse. It does not have a compiler attached to it. As stated above, the highlightjs backend that does the code formatting for Discourse does not have mojo support.

Since mojo is a compiled language, linting would an organizational “idea”. For example, Google has guidelines for how python, a scripted language, should **look**.
