Skip to content

Extract specific code blocks by specifying the language #10

@Ehsan1997

Description

@Ehsan1997

User Story

As a user,
I want to specify what language code blocks I am after.

Background

In a markdown, there could be multiple code blocks belonging to different languages. I would like to specify the specific language I want and get all the code blocks belonging to it.

Acceptance Criteria

Add test case to tests/test_mdextractor.py verifying:

def test_backticks_inside_code_content(self):
    text = '''```python
    print("hello world")
    ```
     ```js
     console.log("hello world");
     ```'''
    self.assertEqual(extract_md_blocks(text, "js"), ['console.log("hello world");'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions