[doc] Use sphinx roles and update the sample code (closes #119623) [applied]