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: 129
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: 100

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

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.

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.

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.

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.

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.

Back
Top