搜索

PythonReactSEOPDF
GitHub Skill

edit-quarto-markdown-files

Edit Quarto (.qmd) and Markdown (.md) files with proper nested code block handling to prevent parser errors and truncated output; standalone utility with no skill dependencies.

crossxwill☆ 5 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

When to Use

  • Editing .qmd (Quarto) files
  • Editing .md (Markdown) files
  • Creating or modifying documentation with code examples
  • Any file containing nested markdown code blocks

Critical: Nested Markdown Code Blocks

When editing markdown files that contain code blocks, you must use four backticks (````) for the outer fence to properly nest three-backtick code examples inside.

Why This Matters

If you use three backticks for both the outer fence and inner code examples, the markdown parser will incorrectly close the outer block at the first inner closing fence, causing:

  • Truncated or malformed output
  • Lost content after the first code example
  • Broken formatting in rendered documents

Correct Pattern

Use four backticks for the outer fence when showing code block examples:

## Example Section

Here is how to write Python code:

```python
def hello():
    print("Hello, world!")
```

And here is R code:

```r
hello <- function() {
  print("Hello, world!")
}
```

Incorrect Pattern (Causes Truncation)

Do NOT use three backticks for both outer and inner fences:

## Example Section

Here is Python code:

```python  <!-- This closes the outer block! -->
def hello():
    print("Hello, world!")

## Quarto-Specific Guidelines

### YAML Front Matter
Quarto files start with YAML front matter between `---` delimiters:

````qmd
---
title: "Document Title"
format: html
execute:
  echo: true
---

# Content starts here

Executable Code Chunks

Quarto code chunks can have execution options:

```{python}
#| label: fig-example
#| fig-cap: "Example figure"
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
```

Cross-References

Use @fig-, @tbl-, @sec- prefixes for cross-references:

See @fig-example for the plot.
See @tbl-results for the data.
See @sec-methods for methodology.

Best Practices

  1. Always use four backticks when your content contains code block examples
  2. Preserve YAML front matter - don't accidentally modify document metadata
  3. Maintain consistent indentation in nested lists and code chunks
  4. Use proper Quarto chunk options with #| syntax for execution control
  5. Test rendering after edits to ensure code blocks display correctly

File Extensions Reference

Extension Description
.qmd Quarto markdown document
.md Standard markdown
.Rmd R Markdown (similar to Quarto)
.ipynb Jupyter notebook (can be edited with Quarto)

Example Edit Task

When asked to add a code example to a markdown file, structure your edit like this:

## New Section

Here's how to load data in Python:

```python
import pandas as pd
df = pd.read_csv("data.csv")
print(df.head())
```

Output:
```
   col1  col2
0     1     a
1     2     b
```

This ensures all nested code blocks render correctly without truncation.

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!