9

I've just realized that you can format code blocks on SFSE by adding the following prefix and suffix:

<!-- language: lang-or-tag-here -->

insert code here

<!-- end snippet -->

Refer to this page for a complete list of supported language hinting codes.

Refer to my answer here for an example.

This is pretty handy. Note that it's using using Google Code Prettify under the hood. Wondering whether it's worth submitting a pull request to add syntax formatting for AMPscript, Apex and Visualforce.

Thoughts?

1
  • 2
    I think most of the time you don't need to add the <!--language--> comment because it uses the tags to guess the format. Works pretty well most of the time!
    – Adrian Larson Mod
    Commented Sep 9, 2016 at 11:28

2 Answers 2

7

I think that'd make for a very useful feature! I'm sure some existing resources can be leveraged using the definition files for the various IDEs that are knocking about the place.

1
  • Agreed. Once you you build/borrow the regex patterns, it should be straightforward to do. I plan to do one for AMPscript. Commented Sep 10, 2016 at 4:13
0

I've seen a few for AMPscript before, it's been a long time since I've been doing dev so I can't say which one is truly the best.

A colleague of mine is using this currently and said it was ok.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .