PmSyntax-Talk
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.
highlightning ordinary (hyper)links?
i have trawled through the pmwiki.syntax.css but found no directive to colorise ordinary links. the brackets are nicely brown, but the link itself is dull. is there any documentation on what css-directives can be added?
Do you mean wiki page links like [[Page|text]]
, should "Page" here be blue? --Petko
how about ordinary links like [[Cookbook/PmSyntax-Talk]]
? --goodguy00?
We cannot currently style such links because they are not detected and marked by the syntax engine. I agree this can be useful and I'll see how we can add it. It can reuse the same style as the external and intermap links. --Petko
* https://www.pmwiki.org * [[Cookbook:PmSyntax]] * [[(Cookbook:)PmSyntax]] * [[Cookbook/PmSyntax]] * [[Cookbook/PmSyntax"tooltip title"|some text in %red%red%% ]] * [[click here -> Cookbook/PmSyntax]] |
Added for 2.3.33, see also many link markups at PmWiki:Links. --Petko
proper resizing of textarea
i suggest removing 2 lines from function resizePre() in pmwiki.syntax.js (about line 480)
// text.style.width = w; // text.style.height = h;
no idea why this is set there, highlighting works fine without it. additionally, the textarea automatically resizes properly when adjusting window.
Agreed - thanks for this, lines removed for 2.3.29. The lines are vestigial from an early prototype when I had occasional misalignment between the transparent text in the textarea and the colored code under it. Many things are different now, and today I couldn't experience misalignment, so I've removed the lines. --Petko
Is there a way of exposing these functions in global space?
// from pmwiki.syntax.js sortRX(); initExtLangs(); PmHiAll(); initEditForm(); //and or (from pmwiki-utils.js) var fn = [autotoc, inittoggle, PmXMail, localTimes, highlight_pre, makesortable]
Reason, I am able to use recipe sortable in QNotes, but not with the version provided by current pmwiki. Maybe missing something.
VKrishn
Sorry, not at the moment. --Petko
Enabled only for a group
I'm trying to enable this only for a specified group, so in my local/group.php
files I have $EnablePmSyntax
= 2;
But I'm not seeing it turned on, is there a different way I should be doing this?
Not specifically for the group, but yes, some files are missing. You need to copy the files pmwiki.syntax.js and pmwiki.syntax.css from the core directory pmwiki/pub/guiedit to the same one on your hosting plan. --Petko
Highlight source
Is it possible to automatically highlighting source (?action=source) ? Benji
Not out of the box, but a recipe can be added, see Cookbook:PagePmSyntax. --Petko
Highlight programming languages
What setting are required to enable %hlt php%
, %hlt css%
, etc?
See WikiStyles#highlight. --Petko
Comments
>>comment<< this text is in a comment >><< %comment% this text is in a comment until %% (:comment this text too 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
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
|
Actually, space+bullet are valid for indented lists:
* list # an item # an item * indented list * another one # 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} |
|
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)]] |
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
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.
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
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.
monospaced
@@,
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.
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
Documented adding these and other custom syntax rules at Cookbook:CustomSyntax. --Petko