Comments (22)
I think it should support github style markdown as well.
from yii2.
Should at least be easily extendable to parse additional syntax like username highlighting or issues numbers, or whatever the like.
from yii2.
Well, current one in 1.1 is extensible enough.
from yii2.
Autoloading looks a bit ugly.
from yii2.
Done but should be improved:
- Code highlighting.
- Github flavor support.
from yii2.
I prefer syntax highlighter to be serverside. Found these options so far:
- https://github.com/markwatkinson/luminous
- http://qbnz.com/highlighter/
- http://pear.php.net/package/Text_Highlighter/ (used in 1.1, not maintained anymore)
- http://fshl.kukulich.cz/
- https://github.com/ccampbell/nijikodo
from yii2.
I like code highlighter used on www.yiiframework.com
from yii2.
@yiidevelop that's the one from Pear and isn't maintained anymore.
from yii2.
@samdark yea, Pear use code syntax php old version, implement very difficult
from yii2.
@qiangxue DocComment on Yii2 class object as MarkDown syntax?
ex: [[ABC]] not found on markdown default
from yii2.
@yiidevelop Markdown + additional syntax for linking to classes, methods and properties.
from yii2.
@samdark Thanks for implement MarkdownHelper
Do you have any plans to convert from html to markdown text?
If someone does find a vendor php do this, please share.
Thank advanced
from yii2.
No, no plans for reverse conversion.
from yii2.
Another highlighting option: https://github.com/scrivo/highlight.php Original JS code is quite good so if port is accurate I'd use it.
from yii2.
I have found today this markdown parser https://github.com/kzykhys/Ciconia
it is already bundled with Github Flavored Markdown support
and has clear Extesions system, looks very promising (as with php-markdown looks very hard to extend, atleast parsing code not very clear for me).
from yii2.
Have made some test of Ciconia
Some visual rendering comparison here http://i.imm.io/1k8Z5.jpeg
Plus is that Ciconia really support some minor GFM things addtionally, liek checkboxes (but it is not so commonly needed).
Great plus is that if is very easy to extend - I was able to add basic Mustache-like syntax parser with custom plugin
public function processWidget(Text $text)
{
$text->replace('/{\s*([^}]+)\s*}/', function (Text $w, Text $name) {
return $w->replaceString("{{$name}}","RENDER $name RENDER");
});
}
so anyone will be able to add any simple snippets-widgets (in any case Markdown is mostly pre-rendered and cached on save to DB), so it depends only on regex you will use.
Minus (quite significant) is memory, speed and dependency on some Symfony components. As we can see for the same text
php-markdown
Memory usage: 334.8046875 Kb
Time taken : 1.1970820426941 sec
Ciconia
Memory usage: 839.6796875 Kb
Time taken : 4.6268730163574 sec
from yii2.
Quite significant speed difference...
from yii2.
http://kzykhys.com/blog/benchmarked-markdown-parsers-written-in-php/
from yii2.
Currently working with https://github.com/erusev/parsedown which is the fastest from the benchmark. I also really like what I see in the code. It currently is not extendable at all but I sent some pull requests and also got positive feedback. Imo this one is a really good choice as it support GFM out of the box and will be highly extendable when my PRs are merged.
from yii2.
Reviewed some existing markdown implementations and decided to start my own: https://github.com/cebe/markdown
All existing implementations are either slow or not extensible so I decided to combine these two factors in a new implementation. It already parses the original markdown very well. Will extend it with MarkdownExtra and GFM soon.
Please help testing it and send bug reports: https://github.com/cebe/markdown/issues
I am going to integrate this with Yii 2 when it is stable enough and will maintain a release at least as stable as yii2 will be.
from yii2.
@cebe Sorry for resurrecting an old issue, but I see you've had a bunch of pull requests merged over on the parsedown repo. Any plans of including parsedown as an official flavor in BaseMarkdown?
from yii2.
@takobell we could consider it but please open a new issue for that.
from yii2.
Related Issues (20)
- BaseActiveRecord save method behaviour HOT 1
- Setting YII_DEBUG=false in humhub 1.15.2 leads to internal server error HOT 2
- Memory usage leak when long operation HOT 6
- createControllerByID function add cache? HOT 14
- Relational queries populating invalid models when foreign key / linking value is 0 HOT 1
- request` failed for
- asDuration() produce wrong plural form when using russian locale HOT 2
- hasOne or hasMany return null when $link with two bigint element
- YII2 whether support reset-transaction? HOT 1
- PHP Deprecated: Calling session_set_save_handler() in `PHP 8.4`. HOT 4
- If the iframe is nested in another domain name, there is an exception in the Yii2 site at https://, where there is a jump from http:// HOT 3
- Invalid fatal error handling in php 8.3 HOT 11
- Does yii2 support connection pooling using redis? HOT 1
- Wrong `columnQuoteCharacter` default in Schema for sqlite3 HOT 2
- wulan HOT 1
- Logic failed in RegularExpressionValidator
- Validator error handling in php 8.3 HOT 2
- How should I use Yii2 version 2.0.42.1 in my project HOT 3
- RequiredValidator with typed properties HOT 7
- Unable to resolve the request "--" with chroot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2.