Linked Code


One special Artemis documentation feature is to embed code snippets which automatically update to reflect additions, deletions, and modifications to your code.

To create a code link, first add # @marker myarker_name anchors before and after the code block you'd like to embed in your documentation.

Then, inside your documentation, add the line # @linkedcode start="start_marker_name" end="end_marker_name"

When you run your code, this # @linkedcode line will be automatically replaced with the code block between the extents of your start and end code markers.

Special Note: This may be used in both @doc and @blockdoc anchors


Example 1: Using @linkedcode to display functions from code in documentation

# @marker math_start
def add(a,b):
  return a + b
def subtract(a,b):
  return a - b
def multiply(a,b):
  return a * b
def divide(a,b):
  return a / b
# @marker math_end

''' @blockdoc
## Code Snippet
# @linkedcode start="math_start" end="math_end"

Did this page help you?