Skip to content

Add syntax highlighting to chapter docs #12

Description

@neelabhg

The chapter exercise documentation (in the chapters/ directory) is written in markdown, and is shown in the "challenge doc" pane (the upper-right pane) in the sys playground.

sys supports GitHub Flavored Markdown (GFM), which supports syntax highlighting for source code.

The current challenge docs do not have syntax highlighting because the code blocks do not have any language identifier. For example, this file has the following fenced code block:

1. Spot the mistake(s) in the following code:
```
  for(len = 0; len <5 ; len++) {
      write(STDOUT_FNO,"I think", 6);
      write(STDOUT_FILENUM,"\n", 6); 
  }
```

which is rendered as

  1. Spot the mistake(s) in the following code:
  for(len = 0; len <5 ; len++) {
      write(STDOUT_FNO,"I think", 6);
      write(STDOUT_FILENUM,"\n", 6); 
  }

This can be syntax-highlighted by using the "c" language identifier:

> 1. Spot the mistake(s) in the following code:
```c
  for(len = 0; len <5 ; len++) {
      write(STDOUT_FNO,"I think", 6);
      write(STDOUT_FILENUM,"\n", 6); 
  }
```

which will render as

  1. Spot the mistake(s) in the following code:
  for(len = 0; len <5 ; len++) {
      write(STDOUT_FNO,"I think", 6);
      write(STDOUT_FILENUM,"\n", 6); 
  }

which is a much better appearance.

The task is to go through current chapters and modify them to use syntax highlighting, and write a document directing future documentation to be written this way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions