Releases: erlsci/erlmd
Releases · erlsci/erlmd
Version 1.2.1 - Code Cleanup
This is a maintenance release that removes unused legacy code while maintaining full backward compatibility.
Code Quality Improvements
- Removed 602 lines of dead code - Cleaned up old parsing functions that were replaced by the AST-based architecture in v1.2.0
- Eliminated all compiler warnings - Down from 47 warnings to 0
- No functional changes - All 298 tests still passing
What Was Removed
The following unused functions from the legacy (pre-AST) implementation were removed:
From erlmd_ast.erl:
skip_blanks/2,skip_blanks_after_one/2- Unused list item detection helpersparse_tag/2- Unused HTML block conversion function
From erlmd.erl:
parse/2,p1/4- Old HTML rendering pipeline (replaced byerlmd_html:render/1)- Old list/blockquote parsing helpers
- Legacy string processing and inline element functions
- Old character escaping and emphasis interpolation code
Note: The lexer and tokenization functions (is_double_indent/1, make_list_str/1, etc.) were preserved as they are still used by the new AST builder.
Upgrade Notes
No changes required - this release is fully backward compatible with v1.2.0.
Version 1.2.0 - Major Architecture Update
This release represents a major refactoring of erlsci/erlmd, a fork of the erlmarkdown library
Breaking Changes
- Module renamed:
markdown→erlmd- Old:
markdown:conv/1 - New:
erlmd:conv/1
- Old:
- Application renamed:
markdown→erlmd(update your rebar.config dependencies)
New Features
AST-Based Architecture
- New intermediate representation: Markdown is now parsed into an Abstract Syntax Tree (AST) before HTML generation
- New module:
erlmd_ast.erl- AST builder with full type definitions - New module:
erlmd_html.erl- Clean HTML renderer from AST - Type definitions:
include/types.hrl- Complete AST type specifications
New API Functions
erlmd:conv_ast/1- Convert Markdown string to AST (returns#document{}record)erlmd:conv_html/1- Convert Markdown string or AST to HTMLerlmd:conv/2- High-level conversion with options:#{format => html | ast}erlmd:conv/1- Convert to HTML using default options (backward compatible)
Improvements
Enhanced CommonMark Compliance (298/298 tests passing)
- Phase 1: Fixed list and blockquote continuation line merging
- Phase 2: Fixed codeblock merging with proper token handling
- Phase 3: Implemented correct hard line breaks (two trailing spaces →
<br />) - Phase 4: Proper list tight/loose detection and rendering
- Phase 5: Improved blockquote hard break handling for better CommonMark compliance
- Phase 6: Fixed tab expansion (tabs expand to spaces in text, preserved in code spans)
- Phase 7: Fixed h2_or_hr disambiguation (setext headers vs horizontal rules)
- Phase 8: Improved HTML tag pass-through handling
Test Infrastructure
- Migrated from JavaScript-generated tests to native Erlang EUnit tests
- 298 comprehensive test cases covering all Markdown features
- Removed old test generation infrastructure (tests/generate_tests.js, etc.)
- Added extensive test documentation in
test/erlmd_tests.erl
Migration Guide (1.1.x → 1.2.0)
Step 1: Update your dependency in rebar.config:
% Old
{deps, [{markdown, "1.1.*"}]}.
% New
{deps, [{erlmd, "1.2.0"}]}.Step 2: Update module calls in your code:
% Old
HTML = markdown:conv(MarkdownText).
% New
HTML = erlmd:conv(MarkdownText).Step 3: If using UTF-8:
% Old
HTML = markdown:conv_utf8(Utf8Text).
% New
HTML = erlmd:conv_utf8(Utf8Text).Step 4: Using the new AST API:
% Get AST
AST = erlmd:conv_ast("# Hello").
% Convert AST to HTML
HTML = erlmd:ast_to_html(AST).
% Or use conv/2 with options
AST = erlmd:conv("# Hello", #{format => ast}).
HTML = erlmd:conv("# Hello", #{format => html}). % defaultDocumentation
- Design documents for AST architecture:
docs/design/ - Phase-by-phase refactoring notes:
workbench/PHASE*_FINDINGS.md