Skip to content

Comment Template

benloh edited this page Feb 7, 2025 · 1 revision

Comment Templates

See PR #319

Defining Comment Types in the Project Template file

Comment types can be defined in the project's *.template.toml file.

[[commentTypes]]
slug = "cmt"
label = "Comment"

  [[commentTypes.prompts]]
  format = "text"
  prompt = "My Comment"
  help = "You might start with 'I think...'"
  feedback = "Feedback is displayed below the input field."

[[commentTypes]]
slug = "evidence"
label = "Evidence Critique or Suggestion"

  [[commentTypes.prompts]]
  format = "dropdown"
  prompt = "Is this supported by evidence?"
  options = ['😀 Yes', '🤔 Some', '🥲 No']
  help = "Select one."
  feedback = "Only one is selectable"
   
  [[commentTypes.prompts]]
  format = "text"
  prompt = "What would you change?"
  help = "Please be specific to help your friend."

Cascading Comment Types

  1. By default, the first comment type defined in *.template.toml is used as the default comment type.
  2. Any new project will use the comment types defined in _default.template.toml. You can edit that file to have new projects automatically use the comment types defined in _default.template.toml.
  3. If there is no type defined in the *.template.toml file, the system will first try to use the types defined DEFAULT_CommentTypes in dc-comments. This allows you to assign a standard set of comments if you're comfortable code diving, but is not intended for regular use.
  4. If DEFAULT_CommentTypes is not defined in dc-comments, the system will fall back to a single generic template. This ensures that there is ALWAYS a usable comment type even if the project and dc-comments are not defined:
const DEFAULT_COMMENTTYPE: TCommentType = {
  slug: 'cmt',
  label: 'Comment', // comment type label
  prompts: [
    {
      format: 'text',
      prompt: 'Comment', // prompt label
      help: 'Use this for any general comment.',
      feedback: ''
    }
  ]
};

Valid Slugs

Currently (as of 1/6/2025), known CType slugs are:

export type CType =
  | 'cmt'
  | 'tellmemore'
  | 'source'
  | 'evidence'
  | 'clarity'
  | 'steps'
  | 'response'
  | string;

...but you can also use any other string for a custom comment.

Clone this wiki locally