How to format content for Powershell.org posts

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

Viewing 4 reply threads
  • Author
    Posts
    • #134372
      Participant
      Topics: 75
      Replies: 120
      Points: 534
      Rank: Major 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
      Topics: 13
      Replies: 4872
      Points: 1,844
      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
      Topics: 27
      Replies: 716
      Points: 1,880
      Helping Hand
      Rank: Community Hero

      Can Gist do different colors and fonts?

    • #134526
      js
      Participant
      Topics: 27
      Replies: 716
      Points: 1,880
      Helping Hand
      Rank: Community Hero
      # 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
      Topics: 2
      Replies: 2
      Points: 68
      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.

Viewing 4 reply threads
  • The topic ‘How to format content for Powershell.org posts’ is closed to new replies.