public IActionResult Markdown(string content) { MarkdownViewModel model = new MarkdownViewModel(); model.Content = content; return(View(model)); }
public IActionResult Markdown(MarkdownViewModel model) { var pipeline = new MarkdownPipelineBuilder() .UseAdvancedExtensions() .Build(); model.RenderedHTML = Markdig.Markdown.ToHtml(model.SourceMarkdown, pipeline); return(View(model)); }
public IActionResult AddMarkdownToPage(string returnUrl, int PageID) { var page = Documentation .Pages.FirstOrDefault(x => x.DocPageID == PageID); var model = new MarkdownViewModel { returnUrl = returnUrl, MarkdownData = page.Data, PageID = PageID, PageName = page.Name }; return(View(model)); }
public IActionResult AddMarkdownToPage(MarkdownViewModel model) { //if (model.MarkdownData?.Contains("<script>")==true) //{ // ModelState.AddModelError("","Unsafe tag <script>...</script>"); //} if (ModelState.IsValid) { var page = Documentation.Pages.FirstOrDefault(x => x.DocPageID == model.PageID); page.Data = model.MarkdownData; page.Name = model.PageName; Documentation.UpdatePage(page); return(LocalRedirect(model.returnUrl)); } return(View(model)); }
public async Task <IActionResult> OnGetAsync(int id) { string token = await idData.GetAccessToken(HttpContext); try { Data = new NotesViewModel { Data = await client.Get(token, id) }; Markdown = new MarkdownViewModel { Raw = Data.Data.Content }; await Data.Load(tagsClient, usersClient, token); /* * List<Relation> res = (await relationsClient.GetAdjacents(token, id)).ToList(); * if (res.Count > 0) * { * RelationHelper.D3Graph graph = await RelationHelper.GenerateGraph(client, tagsClient, res, token); * Graph = new GraphViewModel * { * Graph = graph, * SelectNodeIndex = graph.nodes.IndexOf(graph.nodes.First(x => x.id == id)), * }; * } * else * { * RelationHelper.D3Graph graph = await RelationHelper.GenerateGraph(client, tagsClient, res, token, new Note[] { Data.Data }); * Graph = new GraphViewModel * { * Graph = graph, * SelectNodeIndex = 0, * }; * } */ } catch { return(NotFound()); } return(Page()); }
public Task <IViewComponentResult> InvokeAsync( string id, string value, LocalizedHtmlString placeHolderText, string htmlName, bool autoFocus, int tabIndex, int rows) { var model = new MarkdownViewModel { Id = id, HtmlName = htmlName, PlaceHolderText = placeHolderText?.Value ?? string.Empty, Value = value, AutoFocus = autoFocus, TabIndex = tabIndex, Rows = rows > 0 ? rows : 10 }; return(Task.FromResult((IViewComponentResult)View(model))); }
public IActionResult Markdown() { var model = new MarkdownViewModel(); return(View(model)); }