Gitpress Scala, Typescript, CPP, Java, Python, LaTeX codes を動かす記事が書ける

Article Outline


これが凄いのかも。。 GitPress uses Code-Knack as the living code evaluator. こんな感じ:

#include <stdio.h>

const int MAX = 10;
int cache[MAX] = {0};

int fib(int x) {
  if (x == 1) return 1;
  if (x == 0) return 0;
  if (cache[x] == 0) {
    int ret = fib(x - 1) + fib(x - 2);
    cache[x] = ret;
  return cache[x];

int main() {
    int i;
    printf("fibonacci series:\n");
    for (i = 0; i < MAX; ++i) {
        printf("%d ", fib(i));
    return 0;

"Run" ボタンを押すと、フィナボッチ数列が出てきます。

LaTeX を使う

To include \LaTeX code in your articles, use the following markdown code:

\{\frac{4}{5}, \sqrt{49},
\, 6, \overline{3}, \, 7\sqrt{5}


\{\frac{4}{5}, \sqrt{49},
\, 6, \overline{3}, \, 7\sqrt{5}

Powered by Typescript Service and Scastie, GitPress supports Markdown extension for Scala and Typescript.

Check the source of this post to learn how to use them.


def sayHello(person: String): Unit = {
  println("こんにちは, " + person)


function sayHello(person: string) {
  console.log("こんにちは, " + person);


GitPress supports Markdown extension for diagrams, you could enable this feature using Markdown's code block syntax

The diagrams are powered by Mermaid, which supports sequence, flowchart and Gantt.

Check the source of this post to learn how to draw diagrams.

Sequence diagram

see doc here

%% Example of sequence diagram
    Alice->>Bob: Hello Bob, how are you?
    Note right of Bob: Bob is thinking
    alt is sick
        Bob->>Alice: Not so good :(
    else is well
        Bob->>Alice: Feeling fresh like a daisy
    opt Extra response
        Bob->>Alice: Thanks for asking


see doc here

  graph LR
    A[Hard edge] -->B(Round edge)
    B --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]

Gantt diagrams

see doc here

    title A Gantt Diagram
    dateFormat  YYYY-MM-DD
    section Section
    A task           :a1, 2014-01-01, 30d
    Another task     :after a1  , 20d
    section Another
    Task in sec      :2014-01-12  , 12d
    another task      : 24d