Re: PHP functions to convert markup efficiently [message #183876 is a reply to message #183855] |
Sat, 23 November 2013 16:38 |
James Harris
Messages: 11 Registered: November 2013
Karma:
|
Junior Member |
|
|
"Arno Welzel" <usenet(at)arnowelzel(dot)de> wrote in message
news:528F7B7D(dot)4030701(at)arnowelzel(dot)de...
> Am 22.11.2013 13:48, schrieb James Harris:
>
>> Having looked at Markdown and Smarty that people suggested it might be
>> better if I bite the bullet and develop my own markup language. It would
>> then be easier both to limit what it allows and also to add features as
>> needed. I have been running some syntax tests and it seems quite easy to
>> do
>> and fast to process even though the markup is currently a little
>> cumbersome
>> to write.
>
> I think this is not a good idea.
>
> Existing markup languages are well documented and there are existing
> implementations to parse the markup and convert it to HTML (or other
> formats) which are not only used by one person - so it is likely that
> bugs will be fixed as well within a reasonable time.
Noted.
> Besides Markdown and Smarty you can also try DokuWiki - it's markup can
> be extended using syntax plugins (and you can create your own plugins as
> well to handle block level or inline elements etc.).
I took a look at DokuWiki (having previously looked at the others). It's
good but does things I don't want. At first glance I couldn't see a way to
take them away and to restrict the formatting it accepts. I'm not sure I
want to invest the time needed to learn any of those packages when, at least
for now, it seems that native PHP is easy enough to use and is far more
flexible.
>>> What kind of markup is needed?
>>
>> Quite a lot. Things like these:
>> * bold, italic
>> * links to local pages and remote URLs
>> * images, code
>> * headers, lists, line breaks
>> * tables
>> * other things will likely be required but are not defined yet
>
> So - if HTML is to complicated you should really try DokuWiki first.
>
> And if even this syntax is too complicated you should not use a markup
> language at all but a WYSWIG editor which produces valid HTML (for
> example TinyMCE or CKEditor).
I am not trying to avoid complexity. Using PHP to convert markup to HTML
allows me to do things like these:
* restrict the elements that can be used (for security)
* add features such as a server-side TOC
* pull in data from various sources
* choose where to place elements such as footnotes
* make each page of the site a consistent structure
Basically, the combination of HTML, CSS, PHP and my own markup codes seems
ideal. Aside from having to devise the coding the rest is completely
standard and incredibly lightweight. As such, there will be no packages and
associated bugfixes to install and it should be very fast.
I'll keep in mind that there are prebuilt options, though, in case I run
into difficulties as I work on this.
James
|
|
|