How to format content for Powershell.org posts

Welcome Forums Web Site Feedback & Assistance How to format content for Powershell.org posts

This topic contains 4 replies, has 4 voices, and was last updated by

 
Participant
3 months ago.

  • Author
    Posts
  • #134372

    Participant
    Points: 476
    Rank: Contributor

    I have been using only PRE and slash-PRE with the the triangular left and right brackets to format PS code for posting.  That's all I know.  But it seems there's more  — even though I am nowhere near posting advanced questions or problems.  My biggest difficulty is in re-editing a post before finalizing.  For example, when I "get back in", some portions are now enclosed in a light blue background and I can't seem to get rid of it.  I first started doing the "first draft" on Notepad and do a Copy/Paste, but it seems not to reproduce faithfully.  I also see the use of BBC codes to help in formatting.   I have "experimented" on a simple very limited basis but do not wish to create "junk" posts that would waste the time/attention of the experts who are taking and giving serious technical questions and answers.  I would appreciate some references to documentation on this specialized environment for posting narratives, PS code and other such related textual material so it is acceptable to the PS.org community.   Many thanks.

  • #134375

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    There isn't really anything "more," no. We treat both the HTML "pre" tag and the square-bracket bbCode "pre" tag identically because people tend to try both.

    That "background" is part of the application of the code formatting; editing from the Text tab lets you see the "unformatted" view. Frankly, and I do keep telling folks this, the very best way to post a code listing is to make a Gist from it on GitHub, and then paste the Gist's URL here. That way GitHub can handle all the formatting and the code lives with them, where it's easier to edit, copy/paste, and so on.

    Apart from that just use the toolbar buttons. We honestly don't need a lot of fancy formatting; syntax-colored code is nice, but Gist does the best possible job of that.

  • #134502
    js

    Participant
    Points: 962
    Helping Hand
    Rank: Major Contributor

    Can Gist do different colors and fonts?

  • #134526
    js

    Participant
    Points: 962
    Helping Hand
    Rank: Major Contributor
    # This is a PowerShell comment.
    
    function MyFunction([Parameter(Position = 0)][System.String]$path)
    {
        :loopLabel foreach ($thisFile in (Get-ChildItem $path))
        {
            Write-Host ; Write-Host -Fore Yellow `
                ('Length:' +
                [System.Math]::Floor($thisFile.Length / 1000))
        }
    } 
    

  • #134924

    Participant
    Points: 65
    Rank: Member

    Can Gist do different colors and fonts?

    If you are skilled in CSS, you can use it to modify how the gist appears (but probably not on this site).

    Check out https://lonekorean.github.io/gist-syntax-themes/ for examples.

The topic ‘How to format content for Powershell.org posts’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort