Jannis
(Heinen321)
March 16, 2015, 2:09am
1
I am using CMarkdown in Yii 1.1.15 and I am not happy with it. That’s what I did:
$text = "
## Headline A
* listpoint 1
* listpoint 2
here some text ...
* listpoint 3
* listpoint 4
## Headline B
* listpoint 5
* listpoint 6
";
<?php $parser = new CMarkdownParser;
echo $parser->safeTransform($text);
?>
Listpoints 1+2+5+6 are ok: <ul><li>…
Listpoints 3+4 are only stars … that is bad
I didn’t find a way to solve the problem and only using the listings with a heading before is not userfriendly.
By the way, other things also don’t work: “--------” for a horizontal line. Who can help?
Jannis
(Heinen321)
March 16, 2015, 3:12pm
2
Googeling I couldn’t find others having my problems.
Is something wrong in my example above?
Or is there nearly noone who is using CMarkdown?
Jannis:
Googeling I couldn’t find others having my problems.
Is something wrong in my example above?
Or is there nearly noone who is using CMarkdown?
I do not use markdown, but when I test your markdown with Markdown Live Preview your markdown seems to be crooked.
Bizley
(Bizley)
March 16, 2015, 5:10pm
4
Do the problems persist when you use transform() instead of safeTransform()? safeTransform adds HTMLPurifier filter.
Jannis
(Heinen321)
March 16, 2015, 5:47pm
5
I am sorry … the problems persist. Any other idea?
Bizley
(Bizley)
March 16, 2015, 7:27pm
6
As you can see here https://michelf.ca/projects/php-markdown/dingus/ the Yii parser works the same way as the original project. The problem with Markdown is it was not standardised from the beginning so many versions of it swarm the net (I think the official version and the standard is http://commonmark.org/ but I’m not sure).
I’m afraid you have to rearrange the text or find some other parser.
Jannis
(Heinen321)
March 16, 2015, 10:01pm
7
Bizley:
As you can see here https://michelf.ca/projects/php-markdown/dingus/ the Yii parser works the same way as the original project. The problem with Markdown is it was not standardised from the beginning so many versions of it swarm the net (I think the official version and the standard is http://commonmark.org/ but I’m not sure).
I’m afraid you have to rearrange the text or find some other parser.
Thanx. I now made lot’s of tests and my result is, CMarkown is a poor implementation of Markdown. Lot’s of features do not work properly.
Is noone of you using CMarkdown or what do you do to to save formatted text into a database-table and then write it save into a view.
I thoght CMarkdown is an easy way to get rid of all XSS-Problems - with a small but often needed set of formatting features.
What do you do?
ronald58
(Yii)
March 16, 2015, 10:59pm
8
Jannis:
Thanx. I now made lot’s of tests and my result is, CMarkown is a poor implementation of Markdown. Lot’s of features do not work properly.
Is noone of you using CMarkdown or what do you do to to save formatted text into a database-table and then write it save into a view.
I thoght CMarkdown is an easy way to get rid of all XSS-Problems - with a small but often needed set of formatting features.
What do you do?
Personally, I prefer HtmlPurifier.
Jannis
(Heinen321)
March 17, 2015, 12:45am
9
I was just thinking about HtmlPurifier as an alternative for CMardownParser.
Can I get happy with it?
My future needs are:
The first-priority need is to be XSS-Save: I want to use
some html-tags: div, h1-3, p, br, table, th, tr, td, span
put in pictures with img
format with css: <div class="xyz">
Will HtmlPurifier be the right way?
Bizley
(Bizley)
March 17, 2015, 7:52am
10
I use Imperavi Redactor as wysiwyg editor with HTMLPurifier to filter the user input.
Jannis
(Heinen321)
March 17, 2015, 8:28am
11
I need it for a forum I am writing for my users. They only get text-input and for experienced users maybe some easy formating like CMarkdown-Parser - but maybe I need an alternative because it has problems. Maybe I must write an own parser in combination with HtmpPurifierer - I think that is not very difficult and time-consuming.
Only for my input I need a little more formating. I must trust Yii but I don’t want to trust and regularly update a foreign editor additionally. Therefore I must write my own text in html.
That should be xss-safe because I trust myself
Otherwise - my input is laying in mysql and who knows what can happen. Therefore I will also filter my own input with HtmlPurifier.
ronald58
(Yii)
March 17, 2015, 2:38pm
12
Maybe you can get some inspiration for the forum extension.