How to get the number of lines of code?

I’m using 3rd party syntax highlighting, but I want to get the code line count to add the line number.
in layouts/_default/_markup/render-codeblock.html :

 {{ $options := slice "noClasses=false" "lineNos=table"}}
 {{ highlight .Inner $lang (delimit $options ",")}}

I use lineNos=table to generate line numbers, noClasses=false and don’t add highlight style files to html ( because if it is added, whenever the browser is refreshed, the default highlighting style will be rendered first, and then the 3rd highlighting )

Although I can also use {{len (split .Inner "\n")}} to get it , is there a better way?