file-links

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Format file references as markdown links

将文件引用格式化为Markdown链接

When referencing files in your output, always format them as markdown links. Use the GitHub-style
#L
fragment for line numbers.
在输出内容中引用文件时,请始终将其格式化为Markdown链接。使用GitHub风格的
#L
片段来指定行号。

Format

格式

With a line number:
[filename.el:42](relative/path/to/filename.el#L42)
With a line range:
[filename.el:42-50](relative/path/to/filename.el#L42-L50)
Without a line number:
[filename.el](relative/path/to/filename.el)
带行号的情况:
[filename.el:42](relative/path/to/filename.el#L42)
带行号范围的情况:
[filename.el:42-50](relative/path/to/filename.el#L42-L50)
不带行号的情况:
[filename.el](relative/path/to/filename.el)

Important

注意事项

  • The link text uses
    :
    for line numbers (e.g.,
    filename.el:42
    ).
  • The URL uses
    #L
    for line numbers (e.g.,
    filename.el#L42
    ).
  • For ranges, the link text uses
    -
    (e.g.,
    filename.el:42-50
    ) and the URL uses
    -L
    (e.g.,
    filename.el#L42-L50
    ).
  • The range must appear in both the link text and the URL.
Do NOT do this:
[filename.el#L42-L50](filename.el#L42)
  • 链接文本使用
    :
    来分隔行号(例如:
    filename.el:42
    )。
  • URL使用
    #L
    来指定行号(例如:
    filename.el#L42
    )。
  • 对于行号范围,链接文本使用
    -
    (例如:
    filename.el:42-50
    ),URL使用
    -L
    (例如:
    filename.el#L42-L50
    )。
  • 行号范围必须同时出现在链接文本和URL中。
请勿这样做:
[filename.el#L42-L50](filename.el#L42)

Rules

规则

  • Use paths relative to the project root.
  • Include line numbers when they are relevant (e.g., error locations, function definitions, modified lines).
  • Use line ranges when referring to a block of code.
  • The link text should be the filename (or relative path if needed for clarity) followed by the line number.
  • 使用相对于项目根目录的路径。
  • 当行号相关时(例如错误位置、函数定义、修改的代码行),请包含行号。
  • 引用代码块时使用行号范围。
  • 链接文本应为文件名(如需清晰表达可使用相对路径)后跟行号。