Text formatting guide

CP hub uses a content editing markup language called CP Hub Flavored Markdown, which is an extension of standard Markdown.

Basic Markdown Syntax

See the Markdown Guide - Basic Syntax for basic Markdown syntax.

LaTeX\LaTeX Expressions

We use KaTeX for rendering LaTeX\LaTeX expressions in Markdown.

Inline equations

To write inline LaTeX\LaTeX expressions, use double dollar signs for block math and single dollar signs for inline math.

Example: $x = \frac{ -b \pm \sqrt{b^2 - 4ac} }{2a}$

This rendered as: x=b±b24ac2ax = \frac{ -b \pm \sqrt{b^2 - 4ac} }{2a}

Block equations

To write block LaTeX\LaTeX expressions, use math code blocks described below (language identifier is math).

Example:

```math
x = \frac{ -b \pm \sqrt{b^2 - 4ac} }{2a}
```

This rendered as:

x=b±b24ac2ax = \frac{ -b \pm \sqrt{b^2 - 4ac} }{2a}
  • Surrounding double dollar signs ($$) to create block equations is not supported. Will be supported in the future.

Code Blocks

To create code blocks, use triple backticks (```) before and after the code. For inline code, use single backticks (`).

Example:

```cpp
#include <bits/stdc++.h>
```

This rendered as:

#include <bits/stdc++.h>

Language syntax highlighting support

To specify the language for syntax highlighting, add the language identifier right after the opening backticks, like: ```cpp.

CP Hub supports syntax highlighting for the following languages:

  • Katex (math)
  • C (c)
  • C++ (cpp)
  • C# (csharp)
  • Python (python)
  • Java (java)
  • Kotlin (kotlin)
  • Go (go)
  • Ruby (ruby)
  • Rust (rust)
  • Dart (dart)

CP Hub Flavored Markdown

CP Hub Flavored Markdown extends standard Markdown with additional features especially interconnectedness between contents within CP hub.

Inspired by GitHub Flavored Markdown (GFM)

Syntax

SyntaxUsageExample InputExample Output
@<username>Mention specific user@SylvesterKwonLoading...
p#<problem_id>Reference specific problemp#0jc_YzOEZlK
Loading...
c#<contest_id>Reference specific contestc#pJ7RylunRng
Loading...
e#<editorial_id>Reference specific editoriale#InbrYf5ckhO
Loading...