Skip to content

feat: add sigil support for module attribute formatting#9

Merged
fahchen merged 4 commits intomainfrom
feat/sigil-support
Aug 1, 2025
Merged

feat: add sigil support for module attribute formatting#9
fahchen merged 4 commits intomainfrom
feat/sigil-support

Conversation

@fahchen
Copy link
Owner

@fahchen fahchen commented Aug 1, 2025

Adds comprehensive support for formatting markdown content within ~S and ~s sigils in module attributes with all delimiter types and proper formatting preservation.

Add support for formatting markdown content within ~S and ~s sigils
used in module attributes like @moduledoc, @doc, @TypeDoc, etc.
Supports all sigil delimiters and preserves original structure.
Includes comprehensive test coverage.
Copilot AI review requested due to automatic review settings August 1, 2025 16:59

This comment was marked as outdated.

fahchen added 2 commits August 2, 2025 01:13
- Fix parameter mismatch in process_sigil_doc_attribute function calls
- Simplify sigil parameter passing with map structure
- Improve delimiter handling in patch builder
- Optimize string operations in test utilities
@fahchen fahchen requested a review from Copilot August 1, 2025 17:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for formatting markdown content in Elixir module attributes using the ~S and ~s sigil syntax, extending the existing markdown formatting capabilities to handle sigil-based documentation strings.

Key changes:

  • Enhanced AST processing to recognize sigil patterns in module attributes
  • Added sigil-specific patch building functionality to maintain sigil syntax
  • Comprehensive test coverage for various sigil delimiters and markdown formatting scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/sigil_attribute_test.exs Comprehensive test suite covering all sigil delimiters and complex markdown scenarios
lib/dprint_markdown_formatter/patch_builder.ex Added sigil-specific replacement string building with delimiter preservation
lib/dprint_markdown_formatter/ast_processor.ex Enhanced AST processing to detect and format sigil-based documentation attributes
Comments suppressed due to low confidence (2)

test/sigil_attribute_test.exs:6

  • [nitpick] The describe block title mentions '~S sigil support' but the PR title and description indicate support for both ~S and ~s sigils. Consider updating to '~S/~s sigil support in module attributes' for clarity.
  describe "~S sigil support in module attributes" do

test/sigil_attribute_test.exs:453

  • The expected output shows 'code blocks' with preserved spaces inside the inline code, but the input shows 'code blocks' as a code block. This appears to be testing incorrect behavior - code blocks should preserve their structure, not be converted to inline code.
        This contains "quotes" inside the sigil. And `code   blocks` too.

@fahchen fahchen merged commit 061724c into main Aug 1, 2025
8 checks passed
@fahchen fahchen deleted the feat/sigil-support branch August 1, 2025 17:29
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.

1 participant