I'm trying to extract some data from a text file in a usable way, however I can't quite work out the correct way to do it. The raw text file looks like this:
<!-- @[Hero(super)] -->
# Creating new contexts
<!-- @[UsageExample] -->
## Usage example
```javascript
Import { ICON_NAME } from 'Icons'
```
<!-- @[/Hero] -->
<!-- @[ArticleSection] -->
I need it to give me some JSON which looks like this:
[
{
"name": "Hero",
"type": "super",
"h1" "Creating new contexts"
},
{
"name": "UsageExample",
"h2" "Usage example",
"codeType": "JavaScript",
"code": "Import { ICON_NAME } from 'Icons'",
"parent": "Hero"
}
]
I am not expecting help with all of it, the finer details are ok. The part I'm struggling with is working out how to determine the content between <!-- @[Hero(super)] -->
and <!-- @[/Hero] -->
tl;dr: I'm looking for a way to extract text between <!-- @[Hero(super)] -->
and <!-- @[/Hero] -->