This repository has been archived on 2022-06-22. You can view files and clone it, but cannot push or open issues or pull requests.
usaco-guide/Content Documentation.md
2020-06-24 16:08:16 -07:00

4.2 KiB

Content Formatting Documentation

All modules are written in Markdown. There are special additions to the markdown that we have added to this site. These special additions are still under development, so they may change frequently. If you are confused about something, or if there's a certain feature that you want to add, reach out to Nathan Wang.

You can use StackEdit to check that latex renders properly.

ordering.ts

Located at content/ordering.ts, this file stores the ordering of the modules. Hopefully the format is self-explanatory (it matches based on "slug"). Let Nathan Wang know if you have questions.

Frontmatter

Frontmatter is the stuff in the beginning of each module that's surrounded by three dashes. Frontmatter is written in YAML. It stores the "metadata" for each module.

YAML formatting is extremely strict. Be careful about spaces. Additionally, escape special characters by wrapping the string with double quotes.

  • ID: Required. The ID of the module. Ex: getting-started, or containers. This ID is used to identify the module, so make sure it is unique and all lowercase with dashes only. The URL will be generated based off this.
  • Title: Required. The title of the module. Ex: Getting Started
  • Author: Required. The author of the module. Ex: Unknown
  • Description: Required. A short description of the module, similar to what codecademy has in their syllabus. Markdown/Latex does not work in the description field.
  • Prerequisites: Optional. Any prerequisites for this module. (Coming soon: If you want to reference a module as a prerequisite, you can list the module ID.)

Problem Lists

todo document this... Relevant files are content/models.ts and src/components/markdown/Problems.tsx. Hopefully, the existing mdx files can help you out...

Problem constructor:

constructor(
  public source: string,
  public name: string,
  public id: string,
  public difficulty?: 'Intro' | 'Easy' | 'Normal' | 'Hard' | 'Very Hard',
  public starred?: boolean,
  public tags?: string[],
  public sketch?: string,
)

Example usage:

---
id: ds
title: Data Structures
author: Nathan Wang, Darren Yao, Benjamin Qi
description: Introductory problems using sets and maps.
prerequisites:
  - Bronze - "Built-In C++ Containers" or "Built-In Java Collections"
---

import { Problem } from "../models"

export const metadata = {
problems: {
standard: [
new Problem("YS", "Associative Array", "associative_array", "Intro"),
new Problem("CSES", "Distinct Numbers", "1621", "Intro"),
new Problem("CSES", "Sum of Two Values", "1640", "Intro", false, [], "Can be solved without sets."),
new Problem("CSES", "Concert Tickets", "1091", "Easy", false, ["iterators"]),
new Problem("CSES", "Towers", "1073", "Easy", false, ["multiset", "greedy"]),
new Problem("CSES", "Traffic Lights", "1163", "Normal", false, ["set"]),
new Problem("CSES", "Room Allocation", "1164", "Normal", false, ["multiset", "greedy"]),
]
}
};

## Standard

Do roughly the first half of the Sorting and Searching section in the [CSES Problem Set](https://cses.fi/problemset/).

<problems-list problems={metadata.problems.standard} />

Spoilers

Spoilers are collapsible elements that only show themselves when the user clicks on it. It's useful when writing solutions to problems.

<spoiler title="Show Solution">

- Insert OP benq solution here

</spoiler>

Info Block

<info-block title="Insert Title Here">

**Markdown is Supported!!**

</info-block>

Optional Block

<optional-content title="Insert Title Here">

Fun fact: the title attribute is optional.

</optional-content>

Example Module

---
id: getting-started
title: Getting Started
description: Welcome to the guide! We'll introduce what programming competitions are and how this guide is organized.
author: Nathan Wang
order: 1
prerequisites:
 - Dummy prerequisite
 - running-cpp
problems:
 - bronze_promote
 - bronze_word
 - bronze_paint
 - bronze_square
---

# Hello World!