[master 1/24] Make the function adding the deprecation doc text more generic