How to insert source code when composing message
How does one insert a code block when composing a message in Thunderbird?
I'd like something like what you get in markdown using
~~~ code goes here ~~~
You get a fixed-width font, no wrap, and everything offset in a block with a different colored background.
Something like the code blocks shown at https://markdown-it.github.io/
Syntax highlighting is OK, as long as it can be disabled.
Все ответы (9)
You might try using HTML and highlight the code and click 'preformat' from the drop-down menu to the left of font selection. If you plan to write more text after the code block, press enter key a few times before entering the code block.
That almost does what I want, but I can't figure out how to offset the code block from the rest of the message with a different colored background or some sort of frame.
Try this: Insert/Table... make it 1x1, border = 3, bgcolor = <choose a color>, paste the text in the table, select the text, Format/Text Style, Code (see picture).
It looks like the easiest option is to use some other tool (e.g. https://gitlab.com/saalen/highlight, or https://tohtml.com/, or emacs/markdown/preview, then copy/paste the result from the browser into thunderbird.
It would be cool if I could figure out how to get the output from an html-generating utility like highlight into the X11 selection/clipboard as HTML rather than plaintext (without having to preview it in a browser and copy it from the browser). I guess I need to figure out how X11 selection types work...
For occasional use, I still think - highlighting the code - clicking preformat from menu - clicking a desired color
would work. However, if you do this frequently and have a preference on appearance, I would create a template that you could click to and then paste the code and see it appear exactly as desired. Include a section for text, one for code, and possibly one for following text. Basic HTML skills would do it. And sfhowe's example gives you a good start.
Изменено
> For occasional use, I still think > - highlighting the code > - clicking preformat from menu > - clicking a desired color
Any time I change the background color, it changes for the entire message. I can't get it to change for one paragraph.
> However, if you do this frequently and have a preference on appearance, I would create a > template that you could click to and then paste the code and see it appear exactly as desired. > Include a section for text, one for code, and possibly one for following text. Basic HTML skills > would do it. And sfhowe's example gives you a good start.
The documentation I've found about templates implies that the template is for an entire message.
How does one apply a template to a selected paragraph or to a paste operation?
I meant setting the color for just the text, not the background.
On templates, yes, they are the entire message. You could set up multiple rows with formatting for text and one for code. Such entries expand automatically.
I meant setting the color for just the text, not the background.
Ah I see.
On templates, yes, they are the entire message. You could set up multiple rows with formatting for text and one for code. Such entries expand automatically.
I'll have to think about how that could work. I don't know ahead of time how many blocks of code there will be or where they will be in relation to blocks of "normal" text.
If you use tables to organise the structure then set the table background colour which is bgcolor.
Select to insert table and then use 'Advanced Edit' button set attribute as bgcolor and choose colour value.
If you already have created the table structure which contains tables or cells that hold paragraph Select the relevant table Format > Table > Table or cell background colour Select either table or cell as relevant. click on choose a colour box and select colour desired, click on ok to choose colour. Click on OK to insert colour into desired area.
Double clickon desired area of table/cell will also open the propertoes so you can use the Advanced edit. There are various options.
Изменено