Skip to content

Better CommonMark comment detection #92

@hawkeyexl

Description

@hawkeyexl

CommonMark syntax allows for comments surrounded by (), ''', or "", and some tools (such as Prettier) like to mix comment usage. Right now Doc Detective prefers (), but it should be flexible enough to support all variations.

Right now, this markdown is correctly resolved:

[comment]: # (test {"testId": "uppercase-conversion", "detectSteps": false})

1. Open the app at [http://localhost:3000](http://localhost:3000).

[comment]: # (step {"goTo": "http://localhost:3000"})

2. Type "hello world" in the input field.

[comment]: # (step {"find": {"selector": "#input", "click": true}})
[comment]: # (step {"type": "hello world"})

3. Click **Convert to Uppercase**.

[comment]: # (step {"find": {"selector": "button", "click": true}})

4. You'll see **HELLO WORLD** in the output.

[comment]: # (step {"find": "HELLO WORLD"})
[comment]: # (test end)

Resolved tests:

{
  "specId": "a326c357-84b4-489a-889c-c077cfb2cbe4",
  "contentPath": "/home/hawkeyexl/Workspaces/resolver/dev/doc-content.md",
  "tests": [
    {
      "testId": "uppercase-conversion",
      "detectSteps": false,
      "steps": [
        {
          "goTo": "http://localhost:3000"
        },
        {
          "find": {
            "selector": "#input",
            "click": true
          }
        },
        {
          "type": "hello world"
        },
        {
          "find": {
            "selector": "button",
            "click": true
          }
        },
        {
          "find": "HELLO WORLD"
        }
      ]
    }
  ]
}

While the following Markdown doesn't resolve correctly, it should:

[comment]: # 'test {"testId": "uppercase-conversion", "detectSteps": false}'

1. Open the app at [http://localhost:3000](http://localhost:3000).

[comment]: # 'step {"goTo": "http://localhost:3000"}'

2. Type "hello world" in the input field.

[comment]: # 'step {"find": {"selector": "#input", "click": true}}'
[comment]: # 'step {"type": "hello world"}'

3. Click **Convert to Uppercase**.

[comment]: # 'step {"find": {"selector": "button", "click": true}}'

4. You'll see **HELLO WORLD** in the output.

[comment]: # 'step {"find": "HELLO WORLD"}'
[comment]: # "test end"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions