Include custom Blazor control in markdown

46 views Asked by At

I have a markdown document I want to display, and inside the markdown i want to add a custom Blazor control. Markdig is currently just ignoring the whole custom control tag. This markdown:

    ## my header
       
   some normal text

    <WikipediaImageControl ImageToDisplayWikipediaRefLink="https://commons.wikimedia.org/w/index.php?curid=1921134"
                        ImageUrl="https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Pisa%2C_gioco_del_ponte.JPG/1200px-Pisa%2C_gioco_del_ponte.JPG"
                        ImageAltText="Gioco del ponte at the Ponte di Mezzina"
                        ImageCreditLink="https://it.wikipedia.org/wiki/Gioco_del_Ponte" />
    
        
    more normal text

results in this HTML

<h1>my header</h1>

<p>some normal text</p>

<p>more normal text</p>

I'm calling the Markdig component in the normal way

_writeup = new MarkupString(Markdown.ToHtml(markdown));

then just putting @_writeup on the page like this

<div class="blog-text">
    @_writeup
</div>

Is there a way to do this?

0

There are 0 answers