Before posting source code, please read this....

In summary, the conversation discusses the various tools available on the toolbar for formatting and preserving code indentation, including buttons for general code, HTML, and PHP. The speakers also suggest adding a button for fixed-width font and improving the bubble hints to provide descriptions of the tags. The conversation ends with the addition of a button for [m] tags and an explanation of its function.
  • #1
MarkFL
Gold Member
MHB
13,288
12
Hello, MHB Community! (Wave)

We have several tools on our toolbar that make posted source code stand out and preserve whitespace so that your indentation is preserved, making it easier to read and copy/paste for those who wish to take it and run it for testing.

For general code, you will find this button useful:

View attachment 5302

Next to that button, you will find buttons specifically for HTML and PHP code. Click the appropriate button, and then paste your code in between the generated tags, or paste your code into your post, then select it, and click the appropriate button to wrap the selected text in the tags.

Thanks! :D
 

Attachments

  • codetoolbar.png
    codetoolbar.png
    18.5 KB · Views: 104
Technology news on Phys.org
  • #2
I have a related question and a suggestion.

Is there a button for fixed-width font?

It might be better to change the bubble hints to provide the description of the tag rather than just the tag's name. For example, I may not know what the sp tags does.
 
  • #3
Evgeny.Makarov said:
Is there a button for fixed-width font?

No, but we do have keyboard shortcuts for it and the noparse tags:

[CTRL][M] = [m][/m] tags - monospace, with gray background.
[CTRL][Q] = [noparse][/noparse] tags.

Evgeny.Makarov said:
It might be better to change the bubble hints to provide the description of the tag rather than just the tag's name. For example, I may not know what the sp tags does.

Great suggestion! (Yes) I have added some javascript to do just that for several of the less obvious tags. :)

edit: I added a button for the [m][/m] tags:

View attachment 5316

And added an explanation of the button to its tooltip. (Yes)
 

Attachments

  • mlinebutton.png
    mlinebutton.png
    8.3 KB · Views: 78

1. What is the purpose of the "Before posting source code, please read this...." message?

The purpose of this message is to remind users to read and follow certain guidelines before sharing their source code. This helps maintain the integrity and quality of the code shared on the platform.

2. Why is it important to read this message before posting source code?

Reading this message before posting source code is important because it outlines important guidelines and best practices for sharing code. Following these guidelines can help avoid potential issues or conflicts with other users.

3. What are some common mistakes that people make when sharing source code?

Some common mistakes when sharing source code include not properly formatting the code, not providing enough context or explanation, and not properly citing or giving credit to the original author.

4. Are there any specific rules or guidelines mentioned in the "Before posting source code, please read this...." message?

Yes, there are specific rules and guidelines mentioned in the message. These may include using proper formatting, commenting your code, providing a clear description, and properly citing the original author.

5. Can I still share my source code if I do not follow the guidelines mentioned in the message?

Yes, you can still share your source code, but it is highly recommended to follow the guidelines mentioned in the message. This will not only improve the quality of your code but also make it easier for others to understand and use.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • Programming and Computer Science
Replies
3
Views
318
  • Programming and Computer Science
Replies
22
Views
5K
Replies
11
Views
2K
  • Sticky
  • DIY Projects
Replies
1
Views
3K
  • Feedback and Announcements
Replies
3
Views
1K
  • Feedback and Announcements
Replies
5
Views
2K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
15
Views
6K
Back
Top