Star

MIT License
Copyright © 2020
CONNECT-platform

linkCode Highlights

To highlight a line in a code snippet, add /*!*/ symbol to the beginning of the line:

1link```go | clojure-example.go

2linkpackage main

3link

4linkimport "fmt"

5link

6linkfunc intSeq() func() int {

7link/*!*/ i := 0

8link/*!*/ return func() int {

9link/*!*/ i++

10link/*!*/ return i

11link/*!*/ }

12link}

13link

14linkfunc main() {

15link nextInt := intSeq()

16link fmt.Println(nextInt())

17link fmt.Println(nextInt())

18link fmt.Println(nextInt())

19link

20link/*!*/ newInts := intSeq()

21link/*!*/ fmt.Println(newInts())

22link}

23link```

clojure-example.go
1linkpackage main

2link

3linkimport "fmt"

4link

5linkfunc intSeq() func() int {

6link i := 0

7link return func() int {

8link i++

9link return i

10link }

11link}

12link

13linkfunc main() {

14link nextInt := intSeq()

15link fmt.Println(nextInt())

16link fmt.Println(nextInt())

17link fmt.Println(nextInt())

18link

19link newInts := intSeq()

20link fmt.Println(newInts())

21link}


linkSpacing and Language Support

The symbol /*!*/ is pre-processed by codedoc before syntax highlighting and removed from the code, so it will not cause any issues in languages where /* ... */ is not a valid comment syntax. This also means that you should not factor it in for line indentation and spacing:

1link```go

2linkfunc a() int {

3link/*!*/ i := 0 // --> these two lines will have same indentation

4link i++ // --> these two lines will have same indentation

5link}

6link```

1linkfunc a() int {

2link i := 0 // --> these two lines will have same indentation

3link i++ // --> these two lines will have same indentation

4link}


linkAdded/Removed Lines

Similar to /*!*/ syntax, you can add /*+*/ or /*-*/ at the beginning of each line to indicate that this is an added or removed line:

1link```rust

2linkuse std::net::TcpListener;

3link/*+*/use std::net::TcpStream;

4link/*+*/use std::io::prelude::*;

5link

6linkfn main() {

7link let listener = TcpListener::bind("127.0.0.1:7878").unwrap();

8link

9link for stream in listener.incoming() {

10link let stream = stream.unwrap();

11link

12link/*-*/ println!("Connection established!");

13link/*+*/ handle_connection(stream);

14link }

15link}

16link

17link/*+*/fn handle_connection(mut stream: TcpStream) {

18link/*+*/ let mut buffer = [0; 512];

19link/*+*/ stream.read(&mut buffer).unwrap();

20link/*+*/ println!("Request: {}", String::from_utf8_lossy(&buffer[..]));

21link/*+*/}

22link```

1linkuse std::net::TcpListener;

2linkuse std::net::TcpStream;

3linkuse std::io::prelude::*;

4link

5linkfn main() {

6link let listener = TcpListener::bind("127.0.0.1:7878").unwrap();

7link

8link for stream in listener.incoming() {

9link let stream = stream.unwrap();

10link

11link println!("Connection established!");

12link handle_connection(stream);

13link }

14link}

15link

16linkfn handle_connection(mut stream: TcpStream) {

17link let mut buffer = [0; 512];

18link stream.read(&mut buffer).unwrap();

19link println!("Request: {}", String::from_utf8_lossy(&buffer[..]));

20link}


Similar to /*!*/, /*+*/ and /*-*/ are pre-processed and language independent, i.e. you can use exactly the same syntax regardless of the language you are using it in.


linkError/Warning Underline

You can use /*~*/ in your code snippets to underline some part that would result in an error:

1link```csharp

2linkpublic Option method() =>

3link new Dictionary()./*~*/TryGetValue/*~*/(0);

4link```

1linkpublic Option<int> method() =>

2link new Dictionary<int, int>().TryGetValue~~~~~~~~~~~(0);


Similarly you can use /*~warn~*/ to underline parts that would result in a warning:

1link```csharp

2linkpublic Option method() =>

3link new Dictionary()./*~warn~*/TryGetValue/*~warn~*/(0);

4link```

1linkpublic Option<int> method() =>

2link new Dictionary<int, int>().TryGetValue~~~~~~~~~~~(0);


Both /*~*/ and /*~warn~*/ work on multiple lines:

1link```csharp

2linkpublic Option /*~*/method() =>

3link new Dictionary().TryGetValue/*~*/(0);

4link```

1linkpublic Option<int> method~~~~~~(~)~ ~=>~~

2link ~~new~~~ ~Dictionary<int, int>~~~~~~~~~~~~~~~~~~~~(~)~.~TryGetValue~~~~~~~~~~~(0);


warning WARNING

Since /*~*/ and /*~warn~*/ are interleaved within rest of the syntax, they ONLY WORK in languages supporting /* ... */ or (* ... *) comment syntax. They are also not pre-processed, so they will be copied alongside the rest of the code.

info NOTE

For languages supporting (* ... *) syntax (such as F#), you can simply use (*~*) and (*~warn~*) for achieving this effect.

Code HighlightsSpacing and Language SupportAdded/Removed LinesError/Warning Underline

Home Overview CLI Theme

Markdownchevron_right
Code Featureschevron_right

Images & Assets

Configurationchevron_right
Customizationchevron_right