Closed ManBearTM closed 6 years ago
@ManBearTM What is the advantage of this over #57 ?
With your commit 2b40b9c689041aee9248805ea6854e9989a5d584 , no matter where you put the @lang
, it will be processed, such as in this case:
/**
* @example <caption>funny text</caption>
* var0: "awesome var"
* var1: "very funny" @lang yaml
*/
The output:
**Example** *(funny text)*
```yaml
var0: "awesome var"
var1: "very funny" @lang yaml
I am not sure it is supposed to work this way. What if the user actually wants to use `@lang` literally somewhere in example. Not only will it be processed, but also left within. Same goes for:
```javascript
/**
* @example
* <caption>funny @lang yaml text</caption>
* var0: "awesome var"
* var1: "very funny"
*/
Output:
**Example** *(funny @lang yaml text)*
```yaml
var0: "awesome var"
var1: "very funny"
@foamy-latte Should've totally checked the existing pull requests beforehand šI don't think there is any advantage over yours. Mine might be slightly simpler, but you seem to cover more edge cases. I think I'll just leave it here for @75lb to decide.
Good catch with the @lang
. The current behavior is actually to search the entire example, but I changed it to search lines[0]
instead of example
, since it just makes sense. It will still match @lang
anywhere on the first line, which might not be ideal, but I tried not to break existing behavior.
duplicate of #57, which was merged. Thanks anyway! š
When trying to specify both a caption and a language for jsdoc examples the language is simply ignored.
This pull request should make it possible to include both by using one of below methods:
This won't work:
To explain the commit, instead of deleting the first line if a caption is present, I extract both caption and lang from the first line (if available). Then if either of them is found, I delete the first line.