asciidoctor-mdpp 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d58ecb185224072cd87d0c5453f0091449464256085277d4c84f096dd9f50639
4
+ data.tar.gz: af21ce8f72001634f739cebff6f0b2ed449fb1b255d60fe33d773f1517a6d1fd
5
+ SHA512:
6
+ metadata.gz: 7cf1aa43614a8a50fd1c93a5d31fbd4ff3a4209cba7b61c8ba476efb868f34be9dfd29f6b347dd4d4aad062170d437c7879976f4434707e423cd1ad0266b4e21
7
+ data.tar.gz: 4dcdba82e56d7e3bffdf59701011315784f5ca257301b382e6688ee954b7cc7b21de0f6bc5ac1729589a675b2087fb8bb6244dcd572a7fd454e311a7631c5fab
@@ -0,0 +1,84 @@
1
+ # Active Context: Asciidoctor-MDPP
2
+
3
+ ## Current Work Focus
4
+
5
+ The current development focus is on stabilizing and enhancing the Asciidoctor-MDPP converter with particular attention to:
6
+
7
+ 1. **Line Break Handling**: Improving line break recovery, especially in list items where the AsciiDoc AST drops continuation content after a trailing `+` character
8
+ 2. **Complex Table Rendering**: Refining the handling of multiline tables to better preserve source content fidelity
9
+ 3. **Test Coverage**: Expanding the test suite with additional edge cases to ensure robust conversion
10
+ 4. **Documentation**: Preparing documentation for the project's upcoming open-source release
11
+
12
+ ## Recent Changes
13
+
14
+ Recent development efforts have addressed:
15
+
16
+ - **Admonition Conversion**: Implemented proper handling of both fenced and short-form admonitions with correct style tags
17
+ - **Image Handling**: Added support for dimensions and styling in image conversion
18
+ - **Section Anchors**: Added support for explicit anchors in section headers
19
+ - **Code Blocks**: Implemented support for code fences with language tags
20
+ - **Page & Thematic Breaks**: Added handling for page breaks and thematic breaks (horizontal rules)
21
+ - **Video Embeds**: Added support for YouTube video embeds
22
+
23
+ ## Development Patterns
24
+
25
+ The project follows these active development patterns:
26
+
27
+ 1. **Test-First Development**: All new features begin with sample/expected fixture pairs before implementation
28
+ 2. **Strict Output Matching**: Tests validate conversion through byte-for-byte comparison of output with expected fixtures
29
+ 3. **Fallback Mechanisms**: Complex conversions implement fallbacks to ensure output is always generated, even with edge cases
30
+ 4. **Source Preservation**: Where AST information is insufficient, source file lookups are used to reconstruct the original content
31
+ 5. **Documentation Updates**: Development guidelines and specifications are updated alongside code changes
32
+
33
+ ## Key Insights & Learnings
34
+
35
+ Working with the Asciidoctor AST has revealed several important insights:
36
+
37
+ - **AST Limitations**: Some AsciiDoc features (like list item continuations) are not fully represented in the AST, requiring additional source processing
38
+ - **Node Context Matters**: The same node type may require different handling based on its parent context (e.g., lists inside other lists)
39
+ - **Source Processing Trade-offs**: Direct source parsing provides more control but introduces dependencies on source file availability
40
+ - **Whitespace Sensitivity**: Exact reproduction of expected output requires careful handling of newlines, indentation, and whitespace
41
+
42
+ ## Decision Framework
43
+
44
+ When implementing new conversion features, the following decision framework is used:
45
+
46
+ 1. **AST-first approach**: Attempt to use Asciidoctor's AST representation when it contains sufficient information
47
+ 2. **Source fallback**: When AST is insufficient, implement controlled source file lookups as a fallback
48
+ 3. **Graceful degradation**: When neither approach works, provide a clear but functional fallback (e.g., TODO comments)
49
+ 4. **Test validation**: Ensure all approaches are validated with comprehensive fixture-based tests
50
+
51
+ ## Next Steps
52
+
53
+ The immediate development roadmap includes:
54
+
55
+ 1. **Line Break Recovery Enhancement**: Improve the source location fallback for list item breaks
56
+ 2. **Nested Content Support**: Enhance handling of deeply nested structures (lists within lists within blocks)
57
+ 3. **Error Reporting**: Add better error messages and warnings for problematic conversions
58
+ 4. **Performance Optimization**: Review and optimize source file lookups and processing
59
+ 5. **Documentation Completion**: Finalize documentation for open-source release
60
+ 6. **GitHub Preparation**: Completed preparation of the repository for public GitHub release by WebWorks - Quadralay Corporation.
61
+
62
+ ## Recent Changes
63
+
64
+ - **Repository Preparation**: Updated `README.md`, created `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`, updated `LICENSE.txt` and `asciidoctor-mdpp.gemspec` for open-source release, including copyright and author attribution to WebWorks - Quadralay Corporation.
65
+ - **Description Update**: Updated the gem's functional description in `gemspec`, `README.md`, `projectbrief.md`, and `productContext.md` to "Ruby-based Asciidoctor converter for converting AsciiDoc files to Markdown++ files."
66
+ - **Cleanup**: Removed `codex.md` and the `.codex` directory.
67
+ - **File Extension Clarification**: Clarified the use of the `.md` file extension for Markdown++ files and its backward compatibility benefits in `README.md`, `docs/mdpp-specification/overview.md`, and `productContext.md`.
68
+ - **Company Name Standardization**: Standardized company name references to "WebWorks - Quadralay Corporation" across `LICENSE.txt`, `asciidoctor-mdpp.gemspec`, `projectbrief.md`, `progress.md`, `productContext.md`, `activeContext.md`, and `README.md`. Updated `gemspec` email to `development@webworks.com`.
69
+
70
+ ## Current Challenges
71
+
72
+ The main technical challenges being addressed are:
73
+
74
+ 1. **Line Break Recovery**: The AST drops content after inline breaks in list items, requiring source reconstruction
75
+ 2. **Table Source Parsing**: Complex table structures benefit from direct source parsing, but this creates dependencies on source file availability
76
+ 3. **Strict Fixture Matching**: Tests require exact byte-for-byte matches, making whitespace and newline handling critical
77
+ 4. **AST Navigation**: Determining the context of nodes (e.g., whether a list is nested) requires careful parent/child relationship analysis
78
+
79
+ ## Collaboration Notes
80
+
81
+ - **Commit Workflow**: Group related changes into focused, logical commits (fixtures, converter updates, documentation)
82
+ - **Test Requirements**: All converter changes must be accompanied by fixture updates to maintain test coverage
83
+ - **Code Style**: Follow Ruby conventions with frozen_string_literal and clean method boundaries
84
+ - **Feature Documentation**: Document conversion details, assumptions, and limitations in the appropriate files under docs/
@@ -0,0 +1,51 @@
1
+ # Product Context: Asciidoctor-MDPP
2
+
3
+ ## The Problem
4
+ Technical writers and documentation teams often face a challenging situation: they need to write content in a structured authoring format (like AsciiDoc) but need to deliver it in a format that's compatible with specific publishing systems or documentation platforms that use Markdown++.
5
+
6
+ Without a reliable converter, authors would be forced to either:
7
+ 1. Manually translate AsciiDoc to Markdown++ (time-consuming and error-prone)
8
+ 2. Write directly in Markdown++ (losing AsciiDoc's powerful features)
9
+ 3. Use standard Markdown output (losing Markdown++'s enhanced capabilities)
10
+
11
+ ## What is Markdown++?
12
+ Markdown++ is an enhanced variant of standard Markdown that extends the basic syntax with additional features. Importantly, Markdown++ files use the standard `.md` file extension to ensure backward compatibility with standard Markdown parsers.
13
+
14
+ 1. **Multiline tables** - Tables that can contain complex content spanning multiple lines, including lists, code blocks, and other Markdown elements
15
+ 2. **Style tags** - HTML comment-based syntax for applying custom styles to content (e.g., `<!-- style:AdmonitionNote -->`)
16
+ 3. **File includes** - Ability to include content from other Markdown++ files (e.g., `<!--include:file.md-->`)
17
+ 4. **Anchors and cross-references** - Enhanced linking capabilities through anchor comments (e.g., `<!-- #id -->`)
18
+
19
+ These extensions make Markdown++ particularly well-suited for technical documentation while maintaining compatibility with basic Markdown parsers.
20
+
21
+ ## How Asciidoctor-MDPP Solves the Problem
22
+ Asciidoctor-MDPP, a Ruby-based Asciidoctor converter for converting AsciiDoc files to Markdown++ files, bridges the gap between AsciiDoc's structured authoring capabilities and Markdown++'s publishing flexibility by:
23
+
24
+ 1. **Providing automated conversion** - Eliminating manual translation work
25
+ 2. **Preserving document structure** - Maintaining the hierarchy and relationships in the original AsciiDoc
26
+ 3. **Supporting Markdown++ extensions** - Translating AsciiDoc features to their Markdown++ equivalents
27
+ 4. **Enabling batch processing** - Converting entire documentation sets with a single command
28
+ 5. **Integrating with existing workflows** - Working with standard Asciidoctor toolchains
29
+
30
+ ## Target Users
31
+ This converter is designed for:
32
+ - Documentation teams using AsciiDoc for authoring but needing Markdown++ output
33
+ - Technical writers who work across multiple documentation systems
34
+ - Documentation toolchain engineers integrating multiple authoring and publishing platforms
35
+ - Open-source projects wanting to maintain documentation in AsciiDoc while publishing to Markdown++-compatible platforms
36
+
37
+ ## User Experience Goals
38
+ - **Seamless conversion** - Authors should be able to write in AsciiDoc without worrying about the conversion process
39
+ - **High fidelity output** - The Markdown++ output should faithfully represent the original AsciiDoc content
40
+ - **Easy integration** - The converter should work with existing Asciidoctor toolchains and workflows
41
+ - **Clear error handling** - When conversion challenges arise, they should be clearly documented and reported
42
+ - **Simple troubleshooting** - Users should be able to easily identify and address conversion issues
43
+ - **Extensibility** - The system should accommodate future enhancements to both AsciiDoc and Markdown++
44
+
45
+ ## Business Context
46
+ WebWorks - Quadralay Corporation is developing this project as an open-source contribution to the technical documentation community. By publishing it on GitHub, WebWorks - Quadralay Corporation aims to:
47
+ - Support the broader documentation toolchain ecosystem
48
+ - Enable more flexible documentation workflows
49
+ - Demonstrate commitment to open-source development
50
+ - Establish expertise in documentation conversion solutions
51
+ - Potentially attract community contributions to enhance the converter's capabilities
@@ -0,0 +1,118 @@
1
+ # Progress: Asciidoctor-MDPP
2
+
3
+ ## What Works
4
+
5
+ The following features have been successfully implemented:
6
+
7
+ ### Core Document Structure
8
+ - [x] Document-level layout and structure conversion
9
+ - [x] Section headers with appropriate levels (`#`, `##`, etc.)
10
+ - [x] Paragraphs with proper spacing
11
+ - [x] Preamble handling
12
+
13
+ ### Block Elements
14
+ - [x] Ordered and unordered lists with proper nesting
15
+ - [x] Paragraphs with line breaks (using raw line processing)
16
+ - [x] Tables (both simple and multiline)
17
+ - [x] Admonitions (both fenced blocks and short-form)
18
+ - [x] Images with dimension attributes
19
+ - [x] Code blocks with language tags
20
+ - [x] Literal blocks
21
+ - [x] Example blocks
22
+ - [x] Page breaks
23
+ - [x] Thematic breaks (horizontal rules)
24
+ - [x] Video embeds (YouTube)
25
+
26
+ ### Inline Elements
27
+ - [x] Inline formatting (strong/emphasis)
28
+ - [x] Inline images
29
+ - [x] Anchors and cross-references
30
+ - [x] Include directives
31
+
32
+ ### MDPP Extensions
33
+ - [x] Style comments for admonitions, tables, etc.
34
+ - [x] Multiline table support
35
+ - [x] Include statement conversion (`include::file.adoc[]` → `<!--include:file.md-->`)
36
+
37
+ ## What's Left to Build
38
+
39
+ ### Conversion Enhancements
40
+ - [ ] Improved list item line break handling
41
+ - [ ] Better support for complex nested structures
42
+ - [ ] Support for additional video providers beyond YouTube
43
+ - [ ] Enhanced error reporting for conversion issues
44
+
45
+ ### Infrastructure
46
+ - [ ] Comprehensive usage documentation
47
+ - [ ] CLI improvements for batch processing
48
+ - [ ] Configuration options for customizing conversion behavior
49
+ - [x] Prepare for open-source GitHub release (including copyright and author attribution to WebWorks - Quadralay Corporation)
50
+
51
+ ## Current Status
52
+
53
+ The project is in active development but already provides a solid foundation for AsciiDoc to Markdown++ conversion. It successfully converts most common AsciiDoc elements with good fidelity, with a few known limitations that are being addressed.
54
+
55
+ ### Readiness Assessment
56
+
57
+ | Component | Status | Notes |
58
+ |-----------|--------|-------|
59
+ | Core Conversion | ✅ Ready | Basic document conversion working well |
60
+ | Tables | ✅ Ready | Both simple and multiline tables supported |
61
+ | Lists | ⚠️ Partial | Basic lists work, line breaks need improvement |
62
+ | Admonitions | ✅ Ready | Both styles supported with correct styling |
63
+ | Code Blocks | ✅ Ready | Code fences with language support working |
64
+ | Images | ✅ Ready | Dimension attributes properly handled |
65
+ | Includes | ✅ Ready | Properly converts to MDPP includes |
66
+ | Videos | ⚠️ Partial | YouTube supported, other providers pending |
67
+ | Documentation | 🟠 In Progress | Core docs exist, needs expansion |
68
+ | Testing | ✅ Ready | Test framework in place with fixtures |
69
+ | Error Handling | 🟠 In Progress | Basic handling exists, needs improvement |
70
+ | Performance | ✅ Ready | Performs well for most documents |
71
+
72
+ ## Known Issues
73
+
74
+ ### List Item Line Breaks
75
+ As documented in `docs/line-break-challenges.md`, there's a challenge with handling line breaks in list items:
76
+
77
+ - **Root Cause**: Asciidoctor's AST drops content after a trailing `+` in list items
78
+ - **Current Workaround**: Uses source location fallback to attempt recovery
79
+ - **Limitations**:
80
+ - Only works when source maps are enabled
81
+ - Requires access to the original source files
82
+ - May fail for complex nested content
83
+
84
+ ### Table Source Parsing
85
+ Complex table handling requires direct source file access:
86
+
87
+ - **Root Cause**: The AST does not preserve multiline cell structure
88
+ - **Current Approach**: Parse the original source for tables
89
+ - **Limitations**:
90
+ - Requires the original source files to be available
91
+ - Falls back to simple rendering for complex cases that fail parsing
92
+
93
+ ### Strict Fixture Matching
94
+ Test requirements create some development challenges:
95
+
96
+ - **Issue**: Tests require exact byte-for-byte matches, including newlines and whitespace
97
+ - **Impact**: Small changes in whitespace can break tests
98
+ - **Current Approach**: Careful handling of newlines and string trimming
99
+
100
+ ## Evolution of Project Decisions
101
+
102
+ ### Initial Approach
103
+ The project began with a focus on AST-based conversion, assuming the Asciidoctor AST would contain all necessary information.
104
+
105
+ ### First Pivot: Source Access
106
+ When AST limitations were discovered (especially for tables and line breaks), the approach evolved to incorporate source file lookups as a fallback mechanism.
107
+
108
+ ### Second Pivot: Testing Strategy
109
+ The testing strategy evolved to use strict fixture matching, which uncovered subtle issues with whitespace and newline handling.
110
+
111
+ ### Current Direction
112
+ The project now uses a hybrid approach:
113
+ - AST-first for most conversions
114
+ - Source lookups for complex structures
115
+ - Carefully controlled whitespace and newline handling
116
+ - Test-driven development with comprehensive fixtures
117
+
118
+ This evolution has created a robust converter that balances fidelity with pragmatism, even in the face of AST limitations.
@@ -0,0 +1,39 @@
1
+ # Project Brief: Asciidoctor-MDPP
2
+
3
+ ## Overview
4
+ Asciidoctor-MDPP is a Ruby-based Asciidoctor converter for converting AsciiDoc files to Markdown++ (MDPP) files. It provides a custom converter for transforming AsciiDoc documents into an enhanced variant of standard Markdown, extending the Asciidoctor framework with specialized conversion capabilities to handle unique Markdown++ features while preserving document structure and formatting.
5
+
6
+ ## Purpose
7
+ The primary purpose of this project is to facilitate the conversion of technical documentation from AsciiDoc format to Markdown++ format, enabling users to leverage AsciiDoc's structured authoring capabilities while targeting systems that work with Markdown++.
8
+
9
+ ## Status
10
+ The gem is currently in active development by WebWorks - Quadralay Corporation and is planned to be published as an open-source project on GitHub. The core conversion functionality is implemented and working well, though there are some known challenges with specific AsciiDoc features.
11
+
12
+ ## Goals
13
+ - Provide a reliable and accurate conversion from AsciiDoc to Markdown++
14
+ - Support all Markdown++ specific features including multiline tables, custom style tags, and file includes
15
+ - Ensure high fidelity conversion that maintains document structure and formatting
16
+ - Create a well-documented, maintainable, and extensible codebase
17
+ - Establish a robust testing framework using Test-Driven Development (TDD)
18
+ - Release as an open-source project to benefit the broader technical writing community
19
+
20
+ ## Key Requirements
21
+ - Maintain a test-driven development approach for all feature additions
22
+ - Support Markdown++ extensions like multiline tables, style tags, and includes
23
+ - Handle AsciiDoc-specific features with appropriate Markdown++ equivalents
24
+ - Provide comprehensive documentation for users and contributors
25
+ - Ensure the converter is compatible with standard Asciidoctor workflows
26
+
27
+ ## Scope
28
+ The project's scope encompasses:
29
+ - Core converter functionality for AsciiDoc to Markdown++ transformation
30
+ - Support for all standard AsciiDoc elements (headings, paragraphs, lists, tables, etc.)
31
+ - Special handling for Markdown++ extensions and styling
32
+ - CLI tools for batch conversion
33
+ - Documentation for usage and contribution
34
+
35
+ ## Non-Goals
36
+ - Support for converting Markdown++ back to AsciiDoc
37
+ - WYSIWYG editing capabilities
38
+ - Web-based conversion interface (focused on CLI/library usage)
39
+ - Support for formats other than AsciiDoc and Markdown++
@@ -0,0 +1,122 @@
1
+ # System Patterns: Asciidoctor-MDPP
2
+
3
+ ## Architecture Overview
4
+
5
+ The Asciidoctor-MDPP converter is built on Asciidoctor's extension framework, specifically its converter system. The architecture follows these key patterns:
6
+
7
+ ```mermaid
8
+ graph TD
9
+ AsciiDoc[AsciiDoc Source] --> Parser[Asciidoctor Parser]
10
+ Parser --> AST[Document AST]
11
+ AST --> MDPP[MDPP Converter]
12
+ MDPP --> Markdown[Markdown++ Output]
13
+
14
+ subgraph "Converter Components"
15
+ MDPP --> NodeHandlers[Node-specific Handlers]
16
+ MDPP --> Extensions[Extension Processors]
17
+ MDPP --> Helpers[Helper Methods]
18
+ end
19
+ ```
20
+
21
+ ## Key Components
22
+
23
+ ### 1. Core Converter Class (MarkdownPPConverter)
24
+ - Registered for the 'mdpp' backend with `.md` file output
25
+ - Implements the primary `convert(node, transform)` method that dispatches to specific node converters
26
+ - Follows the Visitor Pattern where different node types are handled by dedicated methods
27
+
28
+ ### 2. Node-Specific Handlers
29
+ - Specialized methods for each node type (e.g., `convert_paragraph`, `convert_section`, `convert_table`)
30
+ - Each handler is responsible for transforming a specific AsciiDoc node type to its Markdown++ equivalent
31
+ - Follow naming convention of `convert_[node_type]` (e.g., `convert_list_item`, `convert_admonition`)
32
+
33
+ ### 3. Extensions
34
+ - Include processor to transform AsciiDoc includes into Markdown++ includes
35
+ - Extension system uses Asciidoctor's built-in extension mechanisms
36
+
37
+ ## Processing Flow
38
+
39
+ 1. Asciidoctor parses the AsciiDoc source into an Abstract Syntax Tree (AST)
40
+ 2. The MDPP converter traverses the AST, starting with the root document node
41
+ 3. For each node, the converter:
42
+ - Determines the node type
43
+ - Dispatches to the appropriate `convert_[node_type]` method
44
+ - Processes the node's attributes and content
45
+ - Recursively processes child nodes as needed
46
+ - Returns the converted Markdown++ content
47
+ 4. The final Markdown++ output is constructed by combining the results from all nodes
48
+
49
+ ## Design Patterns
50
+
51
+ ### Visitor Pattern
52
+ The converter implements a visitor pattern by:
53
+ - Defining a `convert` method that dispatches to specialized handlers
54
+ - Using node-specific conversion methods to handle each node type
55
+ - Traversing the document tree recursively
56
+
57
+ ### Default Fallback Pattern
58
+ For unimplemented node types, the system:
59
+ - Uses a TODO comment as a fallback (`<!-- TODO: [node_type] -->`)
60
+ - Ensures graceful degradation for unsupported features
61
+ - Provides clear indicators of unconverted content
62
+
63
+ ### AST Fallback Pattern
64
+ For complex structures like tables:
65
+ - First attempts to use source-based parsing for sophisticated rendering
66
+ - Falls back to AST-based rendering when source parsing fails
67
+ - Ensures consistent output even with malformed input
68
+
69
+ ### Recursive Conversion
70
+ - Most container nodes recursively convert their children
71
+ - Node parent-child relationships are maintained during conversion
72
+ - Child blocks are joined with appropriate spacing based on context
73
+
74
+ ## Critical Implementation Paths
75
+
76
+ ### Table Conversion
77
+ ```mermaid
78
+ flowchart TD
79
+ Table[Table Node] --> Check{More than\n2 columns?}
80
+ Check -->|Yes| SimpleAST[Simple AST-based\nTable Conversion]
81
+ Check -->|No| TrySource[Try Source-based\nMultiline Parsing]
82
+ TrySource --> Success{Successful?}
83
+ Success -->|Yes| MultilineTable[Emit Multiline\nMarkdown++ Table]
84
+ Success -->|No| FallbackAST[Fallback to\nAST-based Conversion]
85
+ ```
86
+
87
+ ### Admonition Conversion
88
+ ```mermaid
89
+ flowchart TD
90
+ Admonition[Admonition Node] --> CheckType{Fenced or\nShort-form?}
91
+ CheckType -->|Fenced| ProcessBlocks[Process Child Blocks\nRecursively]
92
+ ProcessBlocks --> QuoteLines[Quote Each Line\nwith > Prefix]
93
+ CheckType -->|Short-form| QuoteRaw[Quote Raw Lines]
94
+ QuoteLines --> AddStyle[Add Style Comment]
95
+ QuoteRaw --> AddStyle
96
+ AddStyle --> Result[Final Markdown++\nAdmonition]
97
+ ```
98
+
99
+ ### List Conversion
100
+ - Special handling for nested lists with proper indentation
101
+ - Distinct conversion paths for ordered and unordered lists
102
+ - Attempts to recover lost line breaks in list items through source location fallback
103
+
104
+ ## Error Handling and Recovery
105
+
106
+ ### Line Break Recovery
107
+ - Paragraph line breaks (trailing `+`) are handled by processing raw lines
108
+ - List-item breaks use a source location fallback mechanism
109
+ - Graceful degradation when recovery isn't possible
110
+
111
+ ### AST Limitations Workarounds
112
+ - Source file lookups for multiline tables
113
+ - Custom parsing for retrieving information lost in the AST
114
+ - Fallbacks for scenarios where AST information is insufficient
115
+
116
+ ## Testing Framework
117
+
118
+ The testing framework follows a fixtures-based approach:
119
+ - Sample AsciiDoc files in `spec/fixtures/samples/`
120
+ - Corresponding expected Markdown++ output in `spec/fixtures/expected/`
121
+ - Tests in `spec/converter_spec.rb` that validate conversion results
122
+ - Strict byte-for-byte comparison for test validation
@@ -0,0 +1,188 @@
1
+ # Tech Context: Asciidoctor-MDPP
2
+
3
+ ## Technology Stack
4
+
5
+ ### Core Technologies
6
+ - **Ruby**: Primary programming language (requires Ruby 3.0.0 or higher)
7
+ - **Asciidoctor**: Base framework for document processing (version ~> 2.0)
8
+ - **RSpec**: Testing framework for Ruby
9
+ - **Bundler**: Dependency management
10
+ - **Rake**: Task automation
11
+
12
+ ### Development Environment
13
+ - **Git**: Version control
14
+ - **RubyGems**: Package management and distribution
15
+ - **Bash**: Shell scripts for conversion utilities
16
+
17
+ ## Development Setup
18
+
19
+ ### Installation
20
+
21
+ ```bash
22
+ # Clone the repository
23
+ git clone https://github.com/[USERNAME]/asciidoctor-mdpp.git
24
+ cd asciidoctor-mdpp
25
+
26
+ # Install dependencies
27
+ bundle install
28
+
29
+ # Setup development environment
30
+ bin/setup
31
+ ```
32
+
33
+ ### Interactive Development
34
+
35
+ ```bash
36
+ # Open an interactive console with the gem loaded
37
+ bin/console
38
+
39
+ # Install the gem locally for testing
40
+ bundle exec rake install
41
+ ```
42
+
43
+ ## Build & Release Process
44
+
45
+ ```bash
46
+ # Run tests
47
+ bundle exec rspec
48
+
49
+ # Build the gem
50
+ gem build asciidoctor-mdpp.gemspec
51
+
52
+ # Release a new version
53
+ # 1. Update version in lib/asciidoctor/mdpp/version.rb
54
+ # 2. Run:
55
+ bundle exec rake release
56
+ ```
57
+
58
+ ## Project Structure
59
+
60
+ ```
61
+ asciidoctor-mdpp/
62
+ ├── adoc/ # Sample AsciiDoc documents
63
+ │ └── samples/ # Various AsciiDoc examples
64
+ ├── bin/ # Executables
65
+ │ ├── console # Interactive Ruby console
66
+ │ └── setup # Development environment setup
67
+ ├── docs/ # Project documentation
68
+ │ ├── conversion-guidelines.md
69
+ │ ├── development-guide.md
70
+ │ ├── line-break-challenges.md
71
+ │ └── mdpp-specification/ # Markdown++ syntax specification
72
+ ├── lib/ # Source code
73
+ │ ├── asciidoctor-mdpp.rb # Main entry point
74
+ │ ├── asciidoctor/ # Core module files
75
+ │ │ ├── mdpp.rb # Module definition
76
+ │ │ ├── mdpp/ # Module components
77
+ │ │ │ └── version.rb # Version information
78
+ │ │ └── converter/ # Converter implementation
79
+ │ │ └── mdpp.rb # Core converter logic
80
+ ├── scripts/ # Utility scripts
81
+ │ ├── convert-mdpp.sh # Batch conversion
82
+ │ └── convert-mdpp-file.sh # Single file conversion
83
+ ├── spec/ # Test specifications
84
+ │ ├── converter_spec.rb # Converter tests
85
+ │ ├── spec_helper.rb # Test setup
86
+ │ └── fixtures/ # Test files
87
+ │ ├── expected/ # Expected Markdown++ output
88
+ │ └── samples/ # Sample AsciiDoc input
89
+ ├── .gitignore # Git ignore patterns
90
+ ├── .rspec # RSpec configuration
91
+ ├── asciidoctor-mdpp.gemspec # Gem specification
92
+ ├── Gemfile # Dependencies
93
+ ├── LICENSE.txt # MIT License
94
+ ├── Rakefile # Rake tasks
95
+ └── README.md # Project overview
96
+ ```
97
+
98
+ ## Testing Framework
99
+
100
+ ### Test-Driven Development Workflow
101
+ 1. **Add sample**: Create a new AsciiDoc file in `spec/fixtures/samples/`
102
+ 2. **Define expected output**: Create corresponding Markdown++ in `spec/fixtures/expected/`
103
+ 3. **Update test spec**: Add test case to `spec/converter_spec.rb`
104
+ 4. **Run tests**: Execute `rspec` to verify conversion fails
105
+ 5. **Implement feature**: Add or modify converter code to handle the new case
106
+ 6. **Verify**: Run tests again to confirm successful conversion
107
+ 7. **Commit**: Save both the code changes and fixture updates together
108
+
109
+ ### Testing Commands
110
+
111
+ ```bash
112
+ # Run all tests
113
+ bundle exec rspec
114
+
115
+ # Run specific test file
116
+ bundle exec rspec spec/converter_spec.rb
117
+
118
+ # Run with detailed output
119
+ bundle exec rspec --format documentation
120
+ ```
121
+
122
+ ## Technical Constraints & Limitations
123
+
124
+ ### Asciidoctor AST Limitations
125
+ - List item inline breaks (trailing `+`) are problematic due to AST dropping continuation content
126
+ - Source location info (`li.source_location`) is only populated when using `Asciidoctor.load_file` with `sourcemap: true`
127
+ - Some table structures require direct source parsing rather than relying solely on the AST
128
+
129
+ ### Operational Requirements
130
+ - For line-break recovery in list items, documents must be loaded with `sourcemap: true`
131
+ - Table conversion requires access to source files for complex structures
132
+ - Strict fixture matching requires precise handling of whitespace and newlines
133
+
134
+ ### Ruby Compatibility
135
+ - Requires Ruby 3.0.0 or higher
136
+ - Uses Ruby's standard library extensively (especially File I/O for source lookups)
137
+
138
+ ## Command Line Usage
139
+
140
+ ### Converting a Single File
141
+ ```bash
142
+ # Using the script
143
+ ./scripts/convert-mdpp-file.sh input.adoc
144
+
145
+ # Using Asciidoctor directly
146
+ asciidoctor -r lib/asciidoctor/converter/mdpp.rb -b mdpp -o output.md input.adoc
147
+ ```
148
+
149
+ ### Batch Conversion
150
+ ```bash
151
+ # Convert all files in a directory
152
+ ./scripts/convert-mdpp.sh <SOURCE_DIR> <OUTPUT_DIR>
153
+ ```
154
+
155
+ ### Programmatic Usage
156
+ ```ruby
157
+ require 'asciidoctor/converter/mdpp'
158
+
159
+ # Option 1: Direct conversion
160
+ output = Asciidoctor.convert_file(
161
+ 'input.adoc',
162
+ backend: 'mdpp',
163
+ safe: :safe,
164
+ require: 'asciidoctor/converter/mdpp',
165
+ attributes: { 'outfilesuffix' => '.md' },
166
+ header_footer: true,
167
+ to_file: false
168
+ )
169
+
170
+ # Option 2: Two-step conversion (for source locations)
171
+ doc = Asciidoctor.load_file(
172
+ 'input.adoc',
173
+ safe: :safe,
174
+ sourcemap: true,
175
+ require: 'asciidoctor/converter/mdpp',
176
+ backend: 'mdpp',
177
+ header_footer: true
178
+ )
179
+ output = doc.convert
180
+ ```
181
+
182
+ ## Ad-hoc Testing
183
+ For rapid testing during development:
184
+
185
+ ```bash
186
+ # One-liner to preview converter output
187
+ ruby -Ilib -r asciidoctor/converter/mdpp -e "puts Asciidoctor.convert_file('spec/fixtures/samples/your.adoc', backend: 'mdpp', safe: :safe, require: 'asciidoctor/converter/mdpp', header_footer: true)"
188
+ ```
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-04-22
4
+
5
+ - Initial release