# Dart not detected by the Preformated text block on forum

**URL:** <https://forums.kodeco.com/t/dart-not-detected-by-the-preformated-text-block-on-forum/171969>\
**Category:** 🙃 Off Topic\
**Created:** [May 26, 2022, 5:10pm UTC](https://forums.kodeco.com/t/dart-not-detected-by-the-preformated-text-block-on-forum/171969 "2022-05-26T17:10:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lauragales](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lauragales/32/110821_2.png) [@lauragales](https://forums.kodeco.com/u/lauragales)\
**Post date:** [May 26, 2022, 5:10pm UTC](https://forums.kodeco.com/t/dart-not-detected-by-the-preformated-text-block-on-forum/171969/1 "2022-05-26T17:10:29Z")

</div>

Hello **raywenderlich** team 👋

The beautifully displayed code blocks in Raywenderlich’s online books and articles are one of the reasons why I enjoy the site 😍

But unlike the books and articles, the code blocks in the forum do not highlight **Dart** code correctly. The example Dart code further below is detected as **Rust** by the _Highlight.js_ library that Discourse utilises, and in a [post](https://forums.kodeco.com/t/chapter-2-about-checking-type/171913/2) I made on another topic, the Dart code was detected as **Python**

A potential solution might be to check if Dart is listed under the `highlighted languages` setting in Discourse’s admin area and enable it, if necessary.

I have tested the preformatted text block on Swift, Dart and Objective-C code, trying both the standard opening tag for automatic detection ````` and the one to set a language.

**Swift** code is detected, but cannot be specifically set using ` ```swift`  
So Swift might also not be enabled under `highlighted languages` setting.

**Dart** is not detected and cannot be set using ` ```dart`

**Objective-C** is detected automatically and can also be set using ` ```objectivec`

Thanks for reading 👍

Example code from [highlight.js demo](https://highlightjs.org/static/demo/) page:

```auto
library app;
import 'dart:html';

part 'app2.dart';

/**
 * Class description and [link](http://dartlang.org/).
 */
@Awesome('it works!')
class SomeClass<S extends Iterable> extends BaseClass<S> implements Comparable {
  factory SomeClass(num param);
  SomeClass._internal(int q) : super() {
    assert(q != 1);
    double z = 0.0;
  }

  /// **Sum** function
  int sum(int a, int b) => a + b;

  ElementList els() => querySelectorAll('.dart');
}

String str = ' (${'parameter' + 'zxc'})';
String str = " (${true ? 2 + 2 / 2 : null})";
String str = " ($variable)";
String str = r'\nraw\';
String str = r"\nraw\";
var str = '''
Something ${2+3}
''';
var str = r"""
Something ${2+3}
""";

checkVersion() async {
  var version = await lookUpVersion();
}

```

---

<div class="post-metadata">

**Author:** ![robertomachorro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/robertomachorro/32/111603_2.png) [@robertomachorro](https://forums.kodeco.com/u/robertomachorro)\
**Post date:** [May 29, 2022, 7:12pm UTC](https://forums.kodeco.com/t/dart-not-detected-by-the-preformated-text-block-on-forum/171969/2 "2022-05-29T19:12:23Z")

</div>

Thanks for bringing this up! I’m forwarding it to the team.

---

<div class="post-metadata">

**Author:** ![lauragales](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lauragales/32/110821_2.png) [@lauragales](https://forums.kodeco.com/u/lauragales)\
**Post date:** [May 31, 2022, 7:18pm UTC](https://forums.kodeco.com/t/dart-not-detected-by-the-preformated-text-block-on-forum/171969/3 "2022-05-31T19:18:20Z")

</div>

Thank you! The preformatted text block in this topic and in the linked post, are now both highlighted correctly as Dart 👍

---

<div class="post-metadata">

**Author:** ![robertomachorro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/robertomachorro/32/111603_2.png) [@robertomachorro](https://forums.kodeco.com/u/robertomachorro)\
**Post date:** [May 31, 2022, 10:05pm UTC](https://forums.kodeco.com/t/dart-not-detected-by-the-preformated-text-block-on-forum/171969/4 "2022-05-31T22:05:25Z")

</div>

Yay! Thanks for testing.
