Block links and pandoc

My workflow is simple: Markdown → LaTeX → pdf.

The conversion is done using Pandoc.

I have a problem with links to blocks. According to the documentation: Block references are specific to Obsidian and not part of the standard Markdown format. Links containing block references won’t work outside of Obsidian. (Internal links - Obsidian Help)

All right, but does anyone have a lua-filter that will replace them using Pandoc?

This solution looks promising, but it doesn’t work for me GitHub - zcysxy/obsidian-pandoc-filters: Pandoc filters and an academic workflow for obsidian

Minimal markdown file.

This is first sentence labeled manually ^this
This is second sentence. ^724e52
This is line referencing to [[#^724e52]] .
This is last one [[#^this]]

It should be converted (more or less) to LaTeX syntax:

This is first sentence labeled manually \label{this}
This is second sentence. \label{724e52}
This is line referencing to \ref{724e52}.
This is last one \ref{this}