Skip to content

🎨 Implement syntax highlight pre-processing transform#97

Merged
szmyty merged 1 commit intomainfrom
copilot/implement-syntax-highlight-transform
Mar 24, 2026
Merged

🎨 Implement syntax highlight pre-processing transform#97
szmyty merged 1 commit intomainfrom
copilot/implement-syntax-highlight-transform

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

Adds a SyntaxHighlightTransform that normalizes fenced code block language tags before rendering, ensuring consistent downstream processing by Pandoc.

Changes

  • src/transforms/syntax_highlight.rs — New transform that detects ``` fenced code blocks and normalizes language tags to lowercase with whitespace trimmed; code body is passed through unchanged
  • src/transforms/registry.rs — Registers SyntaxHighlightTransform as the 3rd step in the standard pipeline (after emoji → variables → syntax)
  • src/transforms/mod.rs — Exports SyntaxHighlightTransform from the transforms module

Behavior

<!-- Input -->
```  Python  
print("hi")
` `` `

<!-- Output -->
```python
print("hi")
` `` `

Edge cases handled: unclosed blocks, nested backtick lines inside a block, missing language tag, trailing newline preservation.

Tests

14 unit tests in syntax_highlight.rs + 4 registry-level integration tests covering the full transform chain.

Original prompt

This section details on the original issue you should resolve

<issue_title>🎨 Implement syntax highlight pre-processing transform</issue_title>
<issue_description>### Title: 🎨 Implement syntax highlight pre-processing transform


Description

Add a transform to prepare code blocks for syntax highlighting.

This prepares content before rendering to HTML/PDF.


Goals

  • Improve code block rendering
  • Prepare for advanced formatting
  • Enable future styling control

Requirements


1. Detect Code Blocks

Identify:

```language
code

---

## 2. Transform Behavior

Options:

- inject classes for styling
- normalize language tags
- prepare for Pandoc highlighting

---

## 3. Keep It Simple

V1:

- detect code blocks
- ensure language tags are preserved

---

### Tests

- code blocks remain valid
- transform does not break content

---

### Acceptance Criteria

- [ ] Transform detects code blocks
- [ ] Content remains valid Markdown
- [ ] Integrated into pipeline
- [ ] Tests pass

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add transform for syntax highlighting pre-processing 🎨 Implement syntax highlight pre-processing transform Mar 24, 2026
Copilot AI requested a review from szmyty March 24, 2026 09:21
@szmyty szmyty marked this pull request as ready for review March 24, 2026 10:03
@szmyty szmyty merged commit 8694fe2 into main Mar 24, 2026
1 check passed
@szmyty szmyty deleted the copilot/implement-syntax-highlight-transform branch March 24, 2026 10:03
@devactivity-app
Copy link

Pull Request Summary by devActivity

Metrics

Cycle Time: 2h 11m Coding Time: 1h 23m

Achievements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🎨 Implement syntax highlight pre-processing transform

2 participants