0

I'm trying to parse a markdown-string:

My model is something like this:

class Model
{
    public string MethodName {get;set;}
    public string CodeBlock {get;set;}
}

json-data of my model:

{
    "MethodName":"Test",
    "CodeBlock":"int[] s = new List<int>().ToArray();"
}

my template looks like this:

string template = @"# @Model.MethodName

```csharp
@Model.CodeBlock
```";

I'm parsing with:

string generatedCode = Razor.Parse(template, model);

the parsed output now looks like:

# Test

```csharp
int[] s = new List&lt;int&gt;().ToArray();
```

So the engine parses < to &lt; and > to &gt; (instead of leaving it with those brackets), which is not correct displayed in a markdown-editor. What I really want to get is:

# Test

```csharp
int[] s = new List<int>().ToArray();
```

Any idea what I could do to get this?

Matthias Burger
  • 5,549
  • 7
  • 49
  • 94

0 Answers0