03 December 2025

Creating links for table of contents of markdown files


[1.0 Mobile Devices](Mobile Devices) 

[1.1 installing and configuring a battery replacement in a laptop](installing and configuring a battery replacement in a laptop) 

[1.2 Installing and configuring a keyboard replacement in a laptop](Installing and configuring a keyboard replacement in a laptop) 

Step 1 - Insert a Carriage Return between ']' and '(', i.e. replacing '](' with ']\r(' in every line

:%s/\](/\]\r(/


Step 2 - In every () line, replace every space with a hyphen

:g/(/s/ /-/g

Step 3 - in every () line, change every uppercase letter into lowercase letter

:g/(/normal 0gu$

Step 4 - in every () line, add '#' after '('

:g/(/normal 0a#


Step 5 - go to every [] line, run the command 'gJ'

:g/\[/normal gJ

Notes:
'J' - there will be a space between the 2 lines which are now joined together
'gJ' - there will be no space between the 2 lines which are now joined together




No comments:

Post a Comment