LQ Suggestions & FeedbackDo you have a suggestion for this site or an idea that will make the site better? This forum is for you.
PLEASE READ THIS FORUM - Information and status updates will also be posted here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
im wondering if somehow you can add an option/field to either the code or quote tags to automatically add line numbers to each line.
i think it would make things a little easier when referring to another poster's code, if the line numbers are inserted at the beginning of each line. this could also be useful in the quote tag, if someone is posting a configuration file, for example.
to use it one would have to change their code/quote tag, ie [code uselinenumbers]...[/code]
i searched for what im talking about, and found one thread on it. however, i would like to touch on the topic again, 6 years later. i just dont think its necessary to have to use the suggestion posted on the mentioned thread to implement this. then again, the mods might think my idea is not necessary
a big difference between the code and quote tags is that code preserves spacing. some people will prefer this when, for example, showing the output of a command, where spacing makes it much more readable. so if someone wants to print some simple (afew lines) output (not programming-related) they may use the code tags. however, it would be unnecessary to have the line numbers displayed right? same would go for a simple few lined-script.
the point im trying to get at is i think it would be best that the tags stay as is, with an extra (explicit) option specifying that the output should have line numbers added.
of course i dont run the show here.. im just giving my input.
I think that's a great idea. I can see one difficulty, though: any implementation of this would probably make it so that copying and pasting the code would drag the line numbers with it. So I suggest that if this feature is implemented, there be a user-toggle-able option to show or not show line-numbers. That way if I'm reading some interesting code (with line-numbers) and want to copy it into Emacs, I can just click the toggle off and be all set to copy (without line-numbers).
@druuna:
i agree i wouldnt want it to be the default. as ive mentioned previously, in order to enable it, the user would add an option/field to the tag in question, explicitly saying they want them to be shown
@taylor:
you make a valid point about copying and pasting the content of the tag. it would definetly be a hassle if the user posted the tag with line numbers, and you copy and paste them somewhere else. it would be your job to have to remove the numbers, which isnt fair and would be a pain.
i would like the line numbers to, again, by default never be shown. however, if the poster gives the extra option, then the content in the tag will (by 'default') have line numbers shown. when other people go to view the post, they can simply click a button to hide them.
better yet, when the line numbers are told to be shown, they will be displayed in a second 'table' to the left of the code/quote tags. the content of the left table will just be a number corresponding to the line number in the table on the right (the content one). this way if you copy everything from the code/quote tag, you will only get its contents, and not the line numbers.
well i hope one of the 'big wigs' get around to reading this post so we can hear their thoughts
You could use "cat -n" to add line numbers to the code and cut and paste that into the code block.
This would allow you to refer to a code fragment instead of the full file.
Code:
222 extern unsigned const int tuner_count;
223
224 extern int microtune_init(struct i2c_client *c);
225 extern int xc3028_init(struct i2c_client *c);
226 extern int tda8290_init(struct i2c_client *c);
227 extern int tda8290_probe(struct i2c_client *c);
228 extern int tea5767_tuner_init(struct i2c_client *c);
Which for published code would be a handy to the readers of the post with copies of the file (as in kernel source code).
I would love to see something like [code=/path/to/source/code.c] to add reference information the way you can refer to a poster, and suggested this or something similar, but it would be to much trouble to implement I guess.
----
After posting, I read the link and the same thing was suggested in the referred post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.