3 users online. Create an account or sign in to join them.Users
Markdown Text Formatter
This is an open discussion with 49 replies, filed under Extensions.
Search
This is the text formatter included with the default Symphony 2 beta installation.
Download: extension-markdown-1.8.zip
I'm running Markdown Extra plus SmartyPants and have a question regarding the quotation marks: As all my texts are in German, I would love to change the quotation marks to „these“ and ‚these‘. I suspect I'd have to change something in the php but have no experience fiddling around with something like this, hence my cry for help!
I guess in extensions/markdown/lib/ edit smartypants.php line 154, 157, 163, 166 and 383-449.
Thanks! I've changed everything that looked as if I had to change it and at least got „these“ right – the single quotes are now kinda messed up, maybe the closing quote gets mixed up with the apostrophe? I seem to have missed out the single opening quote (when not inside a double quote) as well, but can't really trace my steps to change that one, either.
So that's what I get now:
„double“ | ‘single’ | „‚single’ in double“ | Johanna’s
It should be:
„double“ | ‚single‘ | „‚single‘ in double“ | Johanna’s
It's not entirely pretty but I can live with it, as single quotes will probably never even be used for the site. Still, if anyone feels like setting me straight, I'd appreciate it!
I'm trying to solve the same problem these days and the reason you won't get this to work by simply changing some values in the smartypants.php is that not only the single character-values won't match german needs but also the general regex-matching-rules don't make sense in german.
Like you already mentioned - the ending single closing quotation mark end the single apostroph are formatted by one rule... won't work for us.
I'm not at all an regex-expert, so I'm progressing quite slow on this, but my current version already gets all your examples right. I could upload it if you want but there are still some cases that will turnout pretty ugly:
Andreas‘ Freundin Jana / die Grimm‘schen Märchen / M‘gladbach / Hast du ‚ne Idee?
Well -- "Hast du ‚ne Idee?" looks awesome that way.
So if anyone already created a fully working german smartypants I'd really appreciate to get my hands on it too... if not I keep on trying to get the wrong cases right...
Searched a bit and haven't found much. Perhaps PHP Smartypants Typographer would be of some help – I only have skimmed over the description yet.
I just read the Typographer-Description and it says
English ‘single quotes’ are not configurable in this way because it would cause problem with apostrophes.
I played around with my smartypants this morning and noticed that getting well formatted german single quotes while not destroying any kind of apostrophes is really getting to complicated for me.
It's easy to set up the right double quotes but for deeper changes you'd need to change quite a lot of rules...
I got these things working now:
‚single‘ / „double“ / „‚single‘ in double“ / „die Grimm’schen Märchen“ / Roman’s ’80s
But there are these two problems left which make my solution not really useful:
Andreas‘ Freundin Jana / Hast du ‚ne Idee?
I think you have to filter the opened-and-closed-single-quotes completely different to match those two cases.
I've got a question concerning the use of Markdown in the context of blog comments:
What's the best way to set up Markdown to disallow certain tag input (like <script />)?
My opinion is biased, but i'd go with Templated Text Formatters and chain Markdown with XSS, and maybe regexp to remove other tags (if You don't want to allow HTML tags).
I use a normal Markdown formatter and then manipulate the content on the front end when writing to the page. Since the XML output of the field will be valid HTML, you can employ Allen's Manipulating HTML in XML method to either:
- only write the content of paragraph elements, or
- catch any
scriptelements and not write the content to the page
Although I'd say this is a method to prevent the after effects, rather than preventing it being saved at all.
I just stumbled across the PHP Typography project which offers more fine-grained controls than SmartyPants. There are some things that don’t work yet (like handling omission in German "Was ’nen Tag!" or the good old ’80s which are currently interpreted as single opening quotes) but it all looks quite promising.
What about adding this to the Markdown formatter? It would be possible to set up typographic standards for each language which could be chosen using a preference setting.
Does this throw up the question again of whether text formatters can be chained?
Yes.
Indeed, the best way would be to offer text formatter chaining so that this formatter would only contain the Markdown and Markdown Extra classes while things like HTML Purifier and SmartyPants would be available as separate formatters that could be chained as needed on a per field base.
This way it would be possible to offer specialised formatters for local typographic adjustments.
How could I have missed this?
Markdown Text Formatter updated to version 1.11 on 30th of April 2010
I try to create a table with the Markdown Extra, by using the example from this site: http://michelf.com/projects/php-markdown/extra/#table, but it doesn’t seem to render the table. Anyone knows what I’m doing wrong? I use syntax just like:
header 1 | header 2 -------- | -------- content | content
@kanduvisla It should work, it does here anyway. A couple of things you could try:
- Double check that Markdown Extra is on for that field.
- Try just the above snippet on its own, something else on the page could be effecting it.
Does the rest of the Markdown get converted in that field?
It seems like you cannot have two different Markdown modes (e.g. Markdown and Markdown Extra) in the same section. In fact, if you try saving an entry, an error is displayed because Markdown() is already declared.
Fatal error: Cannot redeclare Markdown() (previously declared in /home/cybe/Documenti/Dropbox/bitflare/alfadom/symphonycms/extensions/markdown/lib/php-markdown-1.0.1n/markdown.php:43) in /home/cybe/Documenti/Dropbox/bitflare/alfadom/symphonycms/extensions/markdown/lib/php-markdown-extra-1.2.4/markdown.php on line 65
Can anybody confirm this?
Create an account or sign in to comment.
A new Extension, “Markdown Text Formatter” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.