web-component-analyzer
web-component-analyzer copied to clipboard
Multiple elements -> Existing README
It would be nice if wca had an option to concatenate its output to an existing README.md, while bumping up it's header levels.
Input:
/**
* @element 'super-man'
* @attr {String} [weakness="kryptonite"] - supe's ultimate weakness
*
* ### Usage
* ```html
* <super-man weakness="lois-lane"></super-man>
* ```
*/
class SuperMan extends HTMLElement {}
/**
* @element 'spider-man'
* @attr {'classic'|'alien'} [suit="classic"] - type of spidey suit
*
* ### Usage
* ```html
* <spider-man suit="classic"></spider-man>
* ```
*/
class SpiderMan extends HTMLElement {}
Existing README.md
# Super Elements
Super elements for super developers.
Here's a bunch of emoji
[![made with open-wc](https://img.shields.io/badge/made%20with-open--wc-%23217ff9)](https://open-wc.org)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](collection/super-elements/smart-elements-community)
Output:
# Super Elements
Super elements for super developers.
Here's a bunch of emoji
[![made with open-wc](https://img.shields.io/badge/made%20with-open--wc-%23217ff9)](https://open-wc.org)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](collection/super-elements/smart-elements-community)
## super-man
### Usage
```html
<super-man weakness="lois-lane"></super-man>
```
| Property | Attribute | Modifiers | Type | Default | Description |
|------------|------------|-----------|----------|--------------|--------------------------|
| `weakness` | `weakness` | | `String` | 'kryptonite' | supe's ultimate weakness |
## spider-man
### Usage
```html
<spider-man suit="classic"></spider-man>
```
| Property | Attribute | Modifiers | Type | Default | Description |
|----------|-----------|-----------|------------------|-----------|---------------------|
| `suit` | `suit` | | `classic|alien` | 'classic' | type of spidey suit |
This could be accomplished by the user with a little bash scripting and some regex, but it would be nice to have some --merge
flag that defaults to README.md
Hi, thanks for your suggestion :-)
I actually already have an undocumented config to set default markdown header level. This option is called --markdown.headerLevel
. I just published version 1.0.2
that opens up for using this option.
In addition, I added a --silent
flag that can be used to prevent WCA from reporting progress to the console.
Now your use case is supported by running the following command using version 1.0.2
:
web-component-analyzer src --silent --markdown.headerLevel 2 >> README.md
In order to do this more elegantly, I suggest that we add options to the markdown output, that can be used to set a specific header or footer in the resulting markdown output. These options could be named --markdown.headerFile
and --markdown.footerFile
.
web-component-analyzer src --markdown.headerFile HEADER.md --outFile README.md
Would that suggestion cover your use case?
That would be ideal, thanks 😁
I think this and #159 are indeed duplicates. @bennypowers please see my "magic comment" suggestion.