Frontend for yields & raises docstrings#141
Conversation
a5af068 to
12e3040
Compare
1ee6f1d to
8a881a1
Compare
| svelteComponent += ` returnDescription={${JSON.stringify(code)}} `; | ||
| } | ||
|
|
||
| if (docstringBody.match(REGEX_YIELDTYPE)) { | ||
| const yieldType = docstringBody.match(REGEX_YIELDTYPE)[1]; | ||
| const { code } = await mdsvexPreprocess.markup({ content: yieldType, filename }); | ||
| svelteComponent += ` returnType={${JSON.stringify(code)}} isYield={true} `; | ||
| } | ||
|
|
||
| if (docstringBody.match(REGEX_RAISEDESC)) { | ||
| const raiseDesc = docstringBody.match(REGEX_RAISEDESC)[1]; | ||
| const { code } = await mdsvexPreprocess.markup({ content: raiseDesc, filename }); | ||
| svelteComponent += ` raiseDescription={${JSON.stringify(code)}} `; | ||
| } | ||
|
|
||
| if (docstringBody.match(REGEX_RAISETYPE)) { | ||
| const raiseType = docstringBody.match(REGEX_RAISETYPE)[1]; | ||
| const { code } = await mdsvexPreprocess.markup({ content: raiseType, filename }); | ||
| svelteComponent += ` raiseType={${JSON.stringify(code)}} `; | ||
| } |
There was a problem hiding this comment.
Eventually, something like a key/value map for the properties and generating the component string at once seems cleaner (rather than multiple svellteComponent += ... followed by a closing tag)
|
I know @LysandreJik was using warning blocks for the raises block to have something in color. Not sure whether it's something we want or not. |
|
I like the current approach! Thanks @mishig25! |
do you mean: you prefer using for the raise? |
|
Sorry, just realized I didn't answer: I was mentioning I like the approach you have taken in your PR, @mishig25 |
|
Bump on this, we're using cc @Wauplin |
closes #172