Summary: Talk page for PmSyntax.
Maintainer: Petko
Users: +2 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Please open new sections below this line.

Highlight programming languages

What setting are required to enable %hlt php%, %hlt css%, etc?

thanks, simon

See WikiStyles#highlight. --Petko

Enabled by default

PmSyntax has turned out really well, and seems very stable. So I'm following up on having a config.php configuration that sets the default to be turned on

thanks, simon
this text is in a comment
%comment% this text is in a comment until %%
(:comment this text too is in a comment until :)

this text is in a comment

this text is in a comment until

Just a thought that it would be "nice" if all commented out markup and text was displayed in the same way simon

Well, these are not the same, so it would be misleading and potentially dangerous to style them the same way. The last one is really removed from the page, only visible in the wiki source text. The first 2 are wikistyles, and the text is printed in the HTML output and sent to the browser (or to the search engine bot). Only browsers that have CSS enabled will hide the text from what is shown to the visitor (if there even is a human visitor). So if wiki editors feel this is safely hidden, they are wrong, and may expose sensitive information this way. --Petko

Thankyou, I hadn't thought about it that way. simon

Start of line space-bullet

Small markup quirk, I wonder if these should only be shown when at start of the line

 * not a bullet list
  ## not a bullet list
* list
## list
 * not a bullet list
  ## not a bullet list
  • list
    1. list

Actually, space+bullet are valid for indented lists:

* list
  # an item
  # an item
    * indented list
    * another one
  # items continue
  • list
    1. an item
    2. an item
      • indented list
      • another one
    3. items continue

PmWiki's code to manage this is very complex, I would really prefer to keep this one simpler, even if it is not byte-for-byte identical with the PHP markup engine. --Petko

Added to PmSyntax#notes. Petko

If you never use space-indented lists, you can add to config.php this rule:
SDVA($CustomSyntax, array(
  'DisableSpaceBullet' => '<bullet   bullet   /^ +(?=[:*#])/mg',
  ## ^^ in StarTrek we don't have space bullets,
  ##    only phasers and quantum torpedoes :-D
It will consume and highlight only the space preceding the bullets, hashes and colons before the core has had the chance to find them. --Petko

Thanks, I'll do that. I'd prefer not to have something that isn't markup highlighted. If I could I would disable the use of the PmWiki markup that allows spaces for indent. I prefer the repeated use of a symbol (asterisk, hash, etc). Actually this markup is a surprise to me. simon

Accented characters

Would it be possible to make it work with accented characters ? Thank you.

edition: test1
édition: test2

edition: test1 édition: test2

Well the first one marks a Page text variable, the second doesn't. --Petko

# {$:edition}
# {$:édition}
  1. test1
  2. {$:édition}

Links with hidden text

Is it possible to distinguish the markup that hides text in links, viz: [[ChordPro(-) markup]]

Like this? --Petko January 02, 2022, at 06:41 AM

* [[(PmWiki.)Documentation Index]]
* [[PmWiki:Documentation(Index)]]
* [[(PmWiki:)Documentation(Index)]]
* [[PmWiki (.) documentation( index)]]
* [[(https://www.)example(.com)]]
excellent simon January 02, 2022, at 09:05 AM

Also marked tooltip titles like [[Link "tooltip title" | text]]. --Petko January 02, 2022, at 08:15 AM

Extend with recipe markup

do you think it might be possible, in the future, to support recipe authors to add additional highlighting, e.g. I'd like to ChordPro to be able to highlight its markup in the text area?

It is possible now, see as example Cookbook:Formula, I have to document it. --Petko December 28, 2021, at 06:18 AM

Documented adding custom syntax rules at Cookbook:CustomSyntax. --Petko

Enabled by default

PS I'm wondering why PmSyntax doesn't seem to be enabled on this page? simon`

It is enabled on all pages, but you need to click the "Highlight" label and it will remember your choice. Unless if there is some bug -- if so, report how to reproduce it.

thanks, I had omitted to do that. Could we please have a configuration that make the default to be turned on (cf CodeMirror) simon December 28, 2021, at 03:50 AM

Note that after the user enables the syntax, this choice is stored in the browser's localStorage and will be applied the next time the user edits a page. So currently the setting is user-based, not wiki-admin-based. :-)

The edit form highlighting is an early experimental version that has not been extensively tested. A misaligned cursor or misaligned lines between the textarea and the highlighted block may cause you to break something, bad. I'd prefer letting users manually enable it, so that they know how to disable it the moment it doesn't work right. You could add a message above the edit form to remind them how to enable/disable it. Let's first test if for a few months, then we can think about adding a "default enabled" option. --Petko December 28, 2021, at 07:15 PM

I can't roll this out this out, other then to my personal site, until I can turn it on for all users simon

Coming from CodeMirror

Its great to see this recipe. As a long time user of CodeMirror I like the idea of something that is easier to maintain, and handles embedded markup. I would very much like to see, for some of the simplest inline markup, the option to show the formatting, e.g.

''italics'',   '''bold''',   '~'~emphasis~'~',   '*'*strong*'*',   @@monospaced@@,
[+big+]   (with all variants (++, ++, +++ ...) treated the same), [-small-]   (with all variants treated the same),
'^superscript^',   '_subscript_',   {+inserted+},   {-deleted-}

Sorry, No. The HTML <textarea> element cannot possibly have different fonts, it must be the exact same, single font, font size, and all character metrics, line metrics, and white-space metrics need to be the same for all characters, see the "Design" section. At most we can have colors and occasionally bold, and we already use bold for the meaning to stand out.

I was talking with Dfaure who wanted to retire CodeMirror now, and I told him that CM has this advantage you outlined, and that new users may find it easier to learn/use/come back to. So he agreed to keep it, for people who may prefer it.

I thought that might be the case for formatting. CodeMirror has been fantastic and served really well, but I think PmSyntax is good enough and I will switch over once it has gone GA and I can set the default to enabled. simon December 28, 2021, at 03:50 AM

You have typed custom markups '*something*' and '~other~' that are not enabled in a default PmWiki installation and will not be highlighted. It will be possible to add a local configuration to recognize these markups, I have to document these. --Petko December 24, 2021, at 07:57 PM

as the markup is included (and commented out) in SampleConfigFile perhaps the configuration could be too. simon December 28, 2021, at 03:50 AM.

Documented adding these and other custom syntax rules at Cookbook:CustomSyntax. --Petko

Talk page for the PmSyntax recipe (users).