Skip to content

Option to output Markdown warnings as JSON #2140

@robertoaloi

Description

@robertoaloi

ex_doc uses the EarMark parser to parse Markdown embedded in Erlang files.

In case of warnings:

-module(test).
-moduledoc """
This file`s Markdown is broken
""".

ex_doc will print them in human-readable format:

mkdir test_ebin
erlc +debug_info -o test_ebin test.erl
ex_doc -f html foobar 1.0.0 test_ebin
    warning: Closing unclosed backquotes ` at end of input
    │
  3 │ This file`s Markdown is broken
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ test.erl:3: (file)

View "html" docs at "doc/index.html"

To use ex_doc programmatically (e.g. in CI), it would be convenient to report warnings in JSON format. For example:

{
  "path": "path/to/test.erl",
  "line": 3,
  "char": 42,
  "severity": "warning",
  "name": "ex_doc",
  "description": "Closing unclosed backquotes ` at end of input",
  "original": "This file`s Markdown is broken",
  "replacement": "This file's Markdown is broken" (maybe one day)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions