Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-31813

Code Block - Language: PowerShell - Refined code highlighting

    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      I'd love to have some refinements to the codeblock parsing of the supported PowerShell highlighter:

      • Everything between '<#' and '#>' (not counting the single hyphens) is a comment. even - or rather especially - if it spans multiple lines.
      • If behind the command "New-Object" is a string with dots inbetween (like ABC.DEF.GHI), that's a .NET class. Special highlighting for that might be appropriate.
      • [ABC.DEF.GHI] is another .NET specific notation
      • [ABC.DEF.GHI]::Function() is calling a .NET function (or property, if called without the "()"). Highlighting those function or property-stubs separately would be great
      • Functions and their parameters appear to be colored in the same color ("Select-Object -First"). I'd much appreciate if those could be varied, so that functions and parameters have similar colors (Example: Functions get a dark blue and parameters a light blue). Powershell code frequently consists of long chains of Function Pipelines with little but functions and their parameters.
      • There is a way in powershell to create a string object across multiple lines: They start with '@"' and end with '"@' (without the single hyphens, but with the double ones). This is not supported in the PowerShell highlighter so far.

      All those would be nice-to-have, though hardly worldshaking, features

            [CONFSERVER-31813] Code Block - Language: PowerShell - Refined code highlighting

            Hi,
            if the feature is broken, might i suggest considering to either fix it or remove it?

            (Also affected by this bug)

            Conan Chiles added a comment - Hi, if the feature is broken, might i suggest considering to either fix it or remove it? (Also affected by this bug)

            Hayes Jupe added a comment -

            Its a bit harsh marking this as resolved, when the issue still remains and Friedrich raises valid points.

            Hayes Jupe added a comment - Its a bit harsh marking this as resolved, when the issue still remains and Friedrich raises valid points.

            Hi Sherif,

            the problem with your proposal is, that I can't justify the effort of learning how to do this (I'd develop the skill from a cold start for a single development. I'm doing system administration, not weg-design, by profession).

            A more serious problem with the Codeblock however has been noted:
            Copy & pasting a script, where functions are indented with tabs (standard for all PowerShell scripting editors) into a codeblock will break the optics. Converting those to whitespaces and then pasting it however will display the entire script in a single paragraph.
            What this means is that I have to manually correct each and every line, which is highly impracticable alas.

            So ... the Codeblock function will serve me well for displaying single lines of script-code, or a very short script passage, but everysthing more complex than this is impracticable on a relevant scale.

            Cheers,
            Friedrich

            Friedrich Weinmann added a comment - Hi Sherif, the problem with your proposal is, that I can't justify the effort of learning how to do this (I'd develop the skill from a cold start for a single development. I'm doing system administration, not weg-design, by profession). A more serious problem with the Codeblock however has been noted: Copy & pasting a script, where functions are indented with tabs (standard for all PowerShell scripting editors) into a codeblock will break the optics. Converting those to whitespaces and then pasting it however will display the entire script in a single paragraph. What this means is that I have to manually correct each and every line, which is highly impracticable alas. So ... the Codeblock function will serve me well for displaying single lines of script-code, or a very short script passage, but everysthing more complex than this is impracticable on a relevant scale. Cheers, Friedrich

            Thanks for the feedback, Friedrich. We don't have any plans on doing this. But in the latest version of Confluence you can create custom code syntax stylesheets. Details are here: https://confluence.atlassian.com/display/DOC/Code+Block+Macro

            Sherif Mansour added a comment - Thanks for the feedback, Friedrich. We don't have any plans on doing this. But in the latest version of Confluence you can create custom code syntax stylesheets. Details are here: https://confluence.atlassian.com/display/DOC/Code+Block+Macro

              smansour Sherif Mansour
              350037d2b12c Friedrich Weinmann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: