Disclaimer: I got as far as:
cat GUIDE.md | sed 's/{@link \([^#]*\)#\([^ ]*\)}/[\1#\2](https:\/\/mercmobily.github.io\/best-webdriver\/\1#\2/g' | less
So, it's nearly functional.
I have a GUIDE.md file which is in pure markdown, but it includes JSDOC links.
I need to scan the GUIDE.md file and change these:
Remember that in {@link Browser#setAlwaysMatchKey AlwaysMatch} or {@link Browser#setRootKey} (all of the {@link Browser Browser} class), you must try [...]
Into:
Remember that in [AlwaysMatch](https://mercmobily.github.io/best-webdriver/Browser#setAlwaysMatchKey) or [Browser#setRootKey](https://mercmobily.github.io/best-webdriver/Browser#setRootKey) (all of the [Browser](https://mercmobily.github.io/best-webdriver/Browser) class), you must try [...]
So basically:
{@link Class#method Description}
->
[Description](https://mercmobily.github.io/best-webdriver/Class.html#method)
{@link Class#method}
->
[Class#method](https://mercmobily.github.io/best-webdriver/Class.html#method)
Where #method is optional, so:
{@link Class Description}
->
[Description](https://mercmobily.github.io/best-webdriver/Class.html)
{@link Class}
->
[Class](https://mercmobily.github.io/best-webdriver/Class.html)
At this point, I got up to:
cat GUIDE.md | sed 's/{@link \([^#]*\)#\([^ ]*\)}/[\1#\2](https:\/\/mercmobily.github.io\/best-webdriver\/\1#\2/g' | less
However:
The
#method
is not optional: it must be there. How do I make it non-mandatory?The description is not considered at all. This is tricky, and I wonder if one SED regexp can do this. Basically, the input can be
{@link Class#method blah blah}
(the link text should beblah blah
or{@link Class#method}
(the link text should beClass#method
)
If making one regexp that includes the optional regexp is too difficult, I will have to pass the file through sed twice.
Ideas?