cli icon indicating copy to clipboard operation
cli copied to clipboard

Refactoring of the MD and HTLM helper

Open BioPhoton opened this issue 9 months ago • 0 comments

User story

As a developer of the CLI and of custom plugins I don't want to care to much about edge cases in MD and HTML reports. At the moment there are slight inconsistencies in the code that I have to know as CLI developer and as plugin developer I have to care about 3rd party information and treat edge cases like considering new lines after code blocks etc.

Acceptance criteria

The utils package should restructure the folders containing MD and HTML formats.

  • [ ] the 2 formats should live in the root of utils in folders called html and md
utils/
|-- src/
    |-- lib/
        |-- md/
        |-- html/
  • [ ] remove constants like SPACE, TAB or NEW_LINE and place the characters directly
  • [ ] as some helpers are named the same (e.g. fontStyle) we should think about exporting the 2 formats in a way that does not cause duplicated exports
  • [ ] all produces content form helpers should be formatted readable
  • [ ] create a helper that uses prettier to format content, but only if it is installed.
  • [ ] The italics and code formatting can be in Markdown now we no longer have HTML tables.

The utils package should provide all needed MD elements as helper including good defaults:

  • [ ] fontStyle - **{content}**
  • [ ] heading - # H1\n
  • [ ] lines - {content}\n{content}\n
    • [ ] the lines helper should autodetect existing new lines and add a maximum of 1 new lines to the contents
  • [ ] paragraph - {content}\n\n
    • [ ] the paragraph helper should autodetect existing new lines and add a maximum of 2 new lines to the contents
  • [ ] paragraphs - {content}\n\n{content}\n\n
    • [ ] the paragraphs helper should autodetect existing new lines and add a maximum of 2 new lines to the contents
  • [ ] table | Heading 1|......\n\n
    • [ ] the table helper is typed with the table model maintained in models
    • [ ] the table helper ends on 2 new lines to have the MD content rendered correctly

The utils package should provide all needed MD elements as helper including good defaults:

  • [ ] fontStyle - <b>{content}</b>
  • [ ] table <table></table>\n\n
  • [ ] details - <details>\n<summary>{summary}<summary>\n{content}\n<details>
    • [ ] it should automatically consider a second new line if the content ends with a code block "```"

Implementation details

No response

BioPhoton avatar Apr 30 '24 07:04 BioPhoton