Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Releases: erlsci/erlmd

Version 1.2.1 - Code Cleanup

13 Nov 00:32
0b7b56a

Choose a tag to compare

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 helpers
  • parse_tag/2 - Unused HTML block conversion function

From erlmd.erl:

  • parse/2, p1/4 - Old HTML rendering pipeline (replaced by erlmd_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

12 Nov 20:20
0b7b56a

Choose a tag to compare

This release represents a major refactoring of erlsci/erlmd, a fork of the erlmarkdown library

Breaking Changes

  • Module renamed: markdownerlmd
    • Old: markdown:conv/1
    • New: erlmd:conv/1
  • Application renamed: markdownerlmd (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 HTML
  • erlmd: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)

  1. Phase 1: Fixed list and blockquote continuation line merging
  2. Phase 2: Fixed codeblock merging with proper token handling
  3. Phase 3: Implemented correct hard line breaks (two trailing spaces → <br />)
  4. Phase 4: Proper list tight/loose detection and rendering
  5. Phase 5: Improved blockquote hard break handling for better CommonMark compliance
  6. Phase 6: Fixed tab expansion (tabs expand to spaces in text, preserved in code spans)
  7. Phase 7: Fixed h2_or_hr disambiguation (setext headers vs horizontal rules)
  8. 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}).  % default

Documentation

  • Design documents for AST architecture: docs/design/
  • Phase-by-phase refactoring notes: workbench/PHASE*_FINDINGS.md
Morty Proxy This is a proxified and sanitized view of the page, visit original site.