我试图在客户端使用PageDown作为编辑器,然后在服务器端将Markdown解析为HTML.
它似乎在客户端工作正常,但在服务器端,tickmarks只是"编纂"后面的字符,而不是它包装的单词.所以,如果我这样做:
test `test` test
我期待这一点,这确实是我在客户端获得的:
test <code>test</code> test
但在服务器端,我最终得到了这个:
test <code>t</code>est<code> </code>test
我创建了一个称为文件pageDown.js,这简直是Markdown.Converter.js和Markdown.Sanitizer.js合并成一个单一的文件,使用此功能补充说:
function getSanitizedHtml(pagedown){
var converter = new Markdown.getSanitizingConverter();
return converter.makeHtml(pagedown);
}
Run Code Online (Sandbox Code Playgroud)
在客户端,我可以像这样使用这个文件:
<!DOCTYPE html>
<html>
<head>
<script src="pageDown.js"></script>
<script>
function convert(){
var html = getSanitizedHtml("test `test` test");
console.log(html);
document.getElementById("content").innerHTML = html;
}
</script>
</head>
<body onload="convert()">
<p id="content"></p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这正确显示: <p>test <code>test</code> test</p>
在(Java)服务器端,我使用相同的文件,通过Java ScriptEngineManager和Invocable:
import java.io.InputStreamReader;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class …Run Code Online (Sandbox Code Playgroud) 我正在使用带有Pagedown和MarkdownSharp的markdown编辑器.
MarkdownSharp中有一个选项"AutoNewlines".
我想知道如何在Pagedown(http://code.google.com/p/pagedown/)中执行此操作.
谢谢!
大家好,我试图解决这个问题,但我无路可走:
这是我的代码:
---
title: "A Multi-page HTML Document"
author: "Yihui Xie and Romain Lesur"
date: "`r Sys.Date()`"
output:
pagedown::html_paged:
toc: true
toc_depth: 3
# change to true for a self-contained document, but it'll be a litte slower for Pandoc to render
self_contained: false
---
# Exercise 1{-}
<div style="width: 100%; height: 20px; border-bottom: 1px solid black; text-align: center">
<span style="font-size: 40px; background-color: white; padding: 0 10px;">
Exercicio 1 <!--Padding is optional-->
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
我想维护目录结构。换句话说,我想点击“练习 1”,它会将我带到练习一的页面。但我希望标题是下面这个自定义标题(我想点击“练习 1”,只看到下面的练习 1 样式): …
我正在使用jQuery 内联编辑插件Jeditable.值得庆幸的是,Jeditable提供了一个插件功能,可以扩展它提供的开箱即用的内联编辑功能.
我希望不要重新发明轮子 - 就像Jeditable 已经存在PageDown插件一样?如果我的Google-fu没有出现任何结果.
我们使用带有AngularJS指令的pagedown编辑器.这是我认为与堆栈溢出时使用的相同:
angular.module("ui.pagedown", [])
.directive("pagedownEditor", function ($compile, $timeout, $window, $q) {
var nextId = 0;
var converter = Markdown.getSanitizingConverter();
Markdown.Extra.init(converter, mdExtraOptions);
converter.hooks.chain("preBlockGamut", function (text, rbg) {
return text.replace(/^ {0,3}""" *\n((?:.*?\n)+?) {0,3}""" *$/gm, function (whole, inner) {
return "<blockquote>" + rbg(inner) + "</blockquote>\n";
});
});
return {
restrict: "E",
scope: {
content: "=",
showPreview: "@",
help: "&",
insertImage: "&"
},
link: function (scope, element, attrs) {
var editorUniqueId;
if (attrs.id == null) {
editorUniqueId = nextId++;
} else {
editorUniqueId = attrs.id; …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过其 Angularjs 模块ng-showdown使用堆栈流Markdown 编辑器摊牌
一切都很顺利,但所包含的图像是其实际/原始尺寸。
如何调整它们的大小以适合文本?
下面给出的是一个显示相同问题的假人。
非常感谢!!!
<html ng-app="theShowdown">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-route.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-animate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.2.1/ui-bootstrap-tpls.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.3.0/showdown.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-sanitize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ng-showdown/1.1.0/ng-showdown.min.js"></script>
<script>
var theShowdown = angular.module('theShowdown', ['ngRoute', 'ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ng-showdown']);
theShowdown.config(function() {
})
theShowdown.controller('theMain', function($scope, $showdown) {
$scope.mymarkdown = `**Hello** _Stackover Flow_ ![Showdown][sd-logo]
[sd-logo]: http://logz.io/wp-content/uploads/2016/02/stack-overflow-logo.png`;
var htmlValue = $showdown.makeHtml($scope.mymarkdown)
})
</script>
</head>
<body ng-controller="theMain">
<p markdown-to-html="mymarkdown"></p>
<textarea rows="4" cols="150" ng-model="mymarkdown"></textarea>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
我一直在尝试提交一个表单,将一个Question对象添加到db中.
但每次我这样做,错误"CSRF令牌无效.请尝试重新提交表单"显示.
在我的表单的内容字段中,我附加了这个插件,这是一个与Stack Overflow相同的编辑器.
这是我的控制器代码:
/**
* Creates a new Question entity.
*
* @Route("/ask", name="question_create")
* @Method("POST")
* @Template("VerySoftAskMeBundle:Question:ask.html.twig")
*/
public function createAction(Request $request) {
$entity = new Question();
$form = $this->createCreateForm($entity);
$tags = $this->getDoctrine()->getRepository('VerySoftAskMeBundle:Tag')->findAll();
date_default_timezone_set('Asia/Manila');
$entity->setDateOfPost(new \DateTime());
$entity->setOwner($this->getUser());
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('question_show', array('id' => $entity->getId())));
}
return array(
'entity' => $entity,
'form' => $form->createView(),
'tags' => $tags
);
}
/**
* Creates a form …Run Code Online (Sandbox Code Playgroud) 我有使用的问题getSanitizingConverter().当我尝试使用以下代码时:
var plainText;
var markdown = new Markdown.Converter();
var markdown = getSanitizingConverter();
plainText = markdownConverter.makeHtml("#Hi");
$(".hello").html(plainText);
Run Code Online (Sandbox Code Playgroud)
我收到一个错误说 Uncaught ReferenceError: getSanitizingConverter is not defined
我的HTML:
<script src="markdown/converter.js"></script>
<script src="markdown/sanitizer.js"></script>
<script src="main.js"></script>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
这是一个codepen RTC
我想生成HTML和带简历的PDF版本pagedown::html_resume和pagedown::chrome_print。
我尝试从提供的示例中运行以下代码pagedown:
---
title: "Lijia Yu's resume"
author: Lijia Yu
date: "`r Sys.Date()`"
output:
pagedown::html_resume:
# set it to true for a self-contained HTML page but it'll take longer to render
self_contained: false
knit: pagedown::chrome_print
---
Aside
================================================================================
{width=80%}
Contact Info {#contact}
--------------------------------------------------------------------------------
- <i class="fa fa-envelope"></i> lijia.yu@outlook.com
- <i class="fa fa-github"></i> [github.com/yulijia](https://github.com/yulijia)
- <i class="fa fa-phone"></i> +1 000-000-0000
- For more information, please contact me via email.
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
Error in pagedown::chrome_print("/Users/Person/Documents/r/projects/Untitled.Rmd", : …Run Code Online (Sandbox Code Playgroud)