diff --git a/pyproject.toml b/pyproject.toml index e1eaed6..1e7e350 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dependencies = [ "httpx", "jinja2", "markdown", + "mdx-breakless-lists", "questionary", ] diff --git a/src/claude_code_transcripts/__init__.py b/src/claude_code_transcripts/__init__.py index f2246a2..18d51bb 100644 --- a/src/claude_code_transcripts/__init__.py +++ b/src/claude_code_transcripts/__init__.py @@ -632,7 +632,11 @@ def format_json(obj): def render_markdown_text(text): if not text: return "" - return markdown.markdown(text, extensions=["fenced_code", "tables"]) + # Use mdx_breakless_lists extension to handle lists without blank lines + # This allows GitHub-flavored markdown style lists + return markdown.markdown( + text, extensions=["fenced_code", "tables", "mdx_breakless_lists"] + ) def is_json_like(text): diff --git a/tests/__snapshots__/test_generate_html/TestGenerateHtml.test_generates_page_001_html.html b/tests/__snapshots__/test_generate_html/TestGenerateHtml.test_generates_page_001_html.html index cdc794b..dfde7c2 100644 --- a/tests/__snapshots__/test_generate_html/TestGenerateHtml.test_generates_page_001_html.html +++ b/tests/__snapshots__/test_generate_html/TestGenerateHtml.test_generates_page_001_html.html @@ -160,9 +160,11 @@

Claude C

Create a simple Python function to add two numbers

-
Thinking

The user wants a simple addition function. I should: -1. Create the function -2. Add a basic test

+
Thinking

The user wants a simple addition function. I should:

+
    +
  1. Create the function
  2. +
  3. Add a basic test
  4. +

This is straightforward.

I'll create a simple Python function for you. Let me write it now.

📝 Write math_utils.py
@@ -252,10 +254,12 @@

Claude C test_subtract - AssertionError: expected 5 but got None

There's a test failure. I need to check the test file and fix it.

-

Here's some markdown content with: -- A bullet list -- inline code -- A link

+

Here's some markdown content with:

+
    +
  • A bullet list
  • +
  • inline code
  • +
  • A link
  • +
def example():
     return 42
 
diff --git a/tests/test_generate_html.py b/tests/test_generate_html.py index 32120c5..c8d98a0 100644 --- a/tests/test_generate_html.py +++ b/tests/test_generate_html.py @@ -131,6 +131,22 @@ def test_render_markdown_text_empty(self): assert render_markdown_text("") == "" assert render_markdown_text(None) == "" + def test_render_markdown_text_bullets_without_blank_line(self): + """Test that bullet points work even without a blank line before them. + + This is a common pattern in Claude's responses where lists immediately + follow text without a blank line separator. + """ + text = "Here's a list:\n- Item 1\n- Item 2\n- Item 3" + result = render_markdown_text(text) + # Should render as a proper list, not as plain text + assert "