You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Remko Popma <re...@gmail.com> on 2017/11/23 07:06:45 UTC

converting markdown links to html links

This took me a while to get right, so let me share it.

Below unix command can be used to replace the markdown links to HTML links
in a text file:

sed -i -e 's/\[\([^\]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g'
RELEASE-NOTES.md

Tricky points were that sed does not recognize the non-greedy qualifier, so
you need to do [^x]* to match _up to_ the next `x`.
Also round brackets are taken literally and capturing group brackets need
to be escaped (the opposite from what I expected).

Re: converting markdown links to html links

Posted by Ralph Goers <ra...@dslextreme.com>.
Those are. I am going to hand-edit the announcement.

Ralph

> On Nov 23, 2017, at 1:06 AM, Remko Popma <re...@gmail.com> wrote:
> 
> Really?
> Looking at announcement.vm they seem identical. 
> 
> 
> 
>> On Nov 23, 2017, at 16:59, Ralph Goers <ra...@dslextreme.com> wrote:
>> 
>> Thanks, although the announcement is going to contain a bit more text than is in the release notes.
>> 
>> Ralph
>> 
>>> On Nov 23, 2017, at 12:06 AM, Remko Popma <re...@gmail.com> wrote:
>>> 
>>> This took me a while to get right, so let me share it.
>>> 
>>> Below unix command can be used to replace the markdown links to HTML links
>>> in a text file:
>>> 
>>> sed -i -e 's/\[\([^\]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g'
>>> RELEASE-NOTES.md
>>> 
>>> Tricky points were that sed does not recognize the non-greedy qualifier, so
>>> you need to do [^x]* to match _up to_ the next `x`.
>>> Also round brackets are taken literally and capturing group brackets need
>>> to be escaped (the opposite from what I expected).
>> 
>> 
> 



Re: converting markdown links to html links

Posted by Remko Popma <re...@gmail.com>.
Really?
Looking at announcement.vm they seem identical. 



> On Nov 23, 2017, at 16:59, Ralph Goers <ra...@dslextreme.com> wrote:
> 
> Thanks, although the announcement is going to contain a bit more text than is in the release notes.
> 
> Ralph
> 
>> On Nov 23, 2017, at 12:06 AM, Remko Popma <re...@gmail.com> wrote:
>> 
>> This took me a while to get right, so let me share it.
>> 
>> Below unix command can be used to replace the markdown links to HTML links
>> in a text file:
>> 
>> sed -i -e 's/\[\([^\]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g'
>> RELEASE-NOTES.md
>> 
>> Tricky points were that sed does not recognize the non-greedy qualifier, so
>> you need to do [^x]* to match _up to_ the next `x`.
>> Also round brackets are taken literally and capturing group brackets need
>> to be escaped (the opposite from what I expected).
> 
> 

Re: converting markdown links to html links

Posted by Ralph Goers <ra...@dslextreme.com>.
Thanks, although the announcement is going to contain a bit more text than is in the release notes.

Ralph

> On Nov 23, 2017, at 12:06 AM, Remko Popma <re...@gmail.com> wrote:
> 
> This took me a while to get right, so let me share it.
> 
> Below unix command can be used to replace the markdown links to HTML links
> in a text file:
> 
> sed -i -e 's/\[\([^\]*\)\](\([^)]*\))/<a href="\2">\1<\/a>/g'
> RELEASE-NOTES.md
> 
> Tricky points were that sed does not recognize the non-greedy qualifier, so
> you need to do [^x]* to match _up to_ the next `x`.
> Also round brackets are taken literally and capturing group brackets need
> to be escaped (the opposite from what I expected).