generated from coulomb/repo-seed
extension for ref resolve, explode, implode, weave, tangle
This commit is contained in:
@@ -34,6 +34,27 @@ title: Original
|
||||
assert "## Intro" in result.markdown
|
||||
assert "### Detail" in result.markdown
|
||||
assert result.operations == ["set_frontmatter", "shift_headings:1"]
|
||||
assert [event.operation for event in result.provenance] == [
|
||||
"set_frontmatter",
|
||||
"shift_headings",
|
||||
]
|
||||
|
||||
|
||||
def test_transform_shifts_headings_without_touching_fenced_code():
|
||||
markdown = """# Intro
|
||||
|
||||
```markdown
|
||||
# Literal Heading
|
||||
```
|
||||
|
||||
## Real Heading
|
||||
"""
|
||||
|
||||
result = transform_markdown(markdown, heading_delta=1)
|
||||
|
||||
assert "```markdown\n# Literal Heading\n```" in result.markdown
|
||||
assert "### Real Heading" in result.markdown
|
||||
assert result.provenance[0].metadata["affected_lines"] == [1, 7]
|
||||
|
||||
|
||||
def test_transform_extracts_selector_text():
|
||||
@@ -104,6 +125,25 @@ def test_resolve_includes_supports_brace_shorthand(tmp_path: Path):
|
||||
assert "Before" in result.markdown
|
||||
assert "Included body." in result.markdown
|
||||
assert "After" in result.markdown
|
||||
assert result.provenance[0].operation == "include"
|
||||
assert result.provenance[0].target_path == str(partial.resolve())
|
||||
|
||||
|
||||
def test_resolve_includes_ignores_markers_inside_fenced_code(tmp_path: Path):
|
||||
partial = tmp_path / "partial.md"
|
||||
partial.write_text("Included body.", encoding="utf-8")
|
||||
markdown = """```markdown
|
||||
{{include:partial.md}}
|
||||
```
|
||||
|
||||
{{include:partial.md}}
|
||||
"""
|
||||
|
||||
result = resolve_includes(markdown, base_dir=tmp_path)
|
||||
|
||||
assert result.markdown.count("Included body.") == 1
|
||||
assert "{{include:partial.md}}" in result.markdown
|
||||
assert result.included_paths == [str(partial.resolve())]
|
||||
|
||||
|
||||
def test_resolve_includes_rejects_cycles(tmp_path: Path):
|
||||
|
||||
Reference in New Issue
Block a user