I found the perfect solution!
A tried so many tools (online converters, pandoc, md-to-pdf, grip, vscode extensions). None of them produced exactly same formatting as in GithHub.
What I did was edit the HTML directly in the browser to leave only the desired part of the window visible.
So I just opened markdown file in github -> opened developer console -> found the html-element with my content -> copy the element -> hide parent element with all content in the page -> insert my copied element near -> ctrl + P -> print to pdf.
P.S.: I suppose this solution only works well for relatively small files. 🙂