0

从事“学校”项目,这是一种stackoverflow“重制”。“翻拍”已经完成,除了一个部分。

试图弄清楚如何实现降价(深度),以便可以发布具有丰富内容的问题和答案,而不仅仅是文本。

现在,在花了半天时间之后,我发现并设法运行了一个示例。

我唯一的问题,它不适用于我的项目。

这是我使用 MarkdownDeep的来源

所以我使用完全相同的方式在我自己的控制器中的给定源中完成视图:'NewQuestion'

要显示的静态(示例)内容:

static string m_Content =
  @"# Edit this Page with MarkdownDeep
    This demo project shows how to use MarkdownDeep in a typical ASP.NET MVC application.
  * Click the *Edit this Page* link below to make changes to this page with MarkdownDeep's editor
  * Use the links in the top right for more info.
  * Look at the file `MarkdownDeepController.cs` for implementation details.
    MarkdownDeep is written by [Topten Software](http://www.toptensoftware.com).
    The project home for MarkdownDeep is [here]
    http://www.toptensoftware.com/markdowndeep). ";

控制器:

public ActionResult Index()
{
    // View the user editable content
    // Create and setup Markdown translator
    var md = new MarkdownDeep.Markdown();
    md.SafeMode = true;
    md.ExtraMode = true;
    // Transform the content and pass to the view
    ViewData["Content"] = md.Transform(m_Content);
    return View();
}

查看(新问题):

..
<div class="row">
    <div class="col-md-8">
       @ViewData["Content"]
    </div>
</div>
...

结果

在此处输入图像描述

如您所见,没有找不到 js 或 jQuery 文件之类的错误。在我看来,内容正确地转换了。

可能是因为该示例运行自<asp>并且我使用的是剃须刀吗?

我真的很困惑,无法弄清楚如何解决狗屎。已经花了几个小时来了解发生了什么。另外,刚开始使用 asp.net,所以你可以在这里真正帮助我。

ps,如果需要更多信息/细节,我很乐意更新这篇文章。

4

1 回答 1

2

尝试使用 Html.Raw()

@Html.Raw(@ViewData["Content"])
于 2015-12-19T22:24:07.393 回答