517Views12Replies

Author Options:

how can i add source code in my instructable(one that appear in box on some instructables)? Answered

i know that this can be done by source button but the main problem is that despite being a pro member their is no source button on my editor.so is their any check box or something in the account settings that must be checked in order to use rich editor

12 Replies

user
bwrussell (author)2015-05-15

This is where the source code button is in the new editor (See image below).
The text box I tend to use is:

<textarea style="width: 600px; height: 300px;" rows="20" readonly="readonly" name="code" cols="75">Enter Code Here</textarea>

You may need to tweak the sizes as necessary.

Select as Best AnswerUndo Best Answer

user
pber (author)bwrussell2015-10-31

Thanks big help with that.

Select as Best AnswerUndo Best Answer

user
iceng (author)bwrussell2015-05-15
user
Raitis (author)2015-05-15

The last time I had to publish code in an 'ible was for the heart lamp and while initially tricky, it eventually turned out fine. See it here.

My solution was to use this for the text box:
<p style="width: 640.0px;height: 360.0px;line-height: 1.0em;overflow: scroll;padding: 5.0px;"><font size="2">

Hope it helps. Although as I understand you have an issue entering the html editing mode as such? If so I have no idea why is that, sorry.

Select as Best AnswerUndo Best Answer

user
iceng (author)Raitis2015-05-15

That's a knockout ible you have there, and that scrolling text box is really neat.

Select as Best AnswerUndo Best Answer

user
Raitis (author)iceng2015-05-19

Thanks, it's really just about the two lines of code I provided here which made that box for me. (:

Select as Best AnswerUndo Best Answer

user
iceng (author)2015-05-14

Convert the code to a jpeg or bmp or other format picture if you don't do PDFiles....

Select as Best AnswerUndo Best Answer

user
Raitis (author)iceng2015-05-15

Code in a picture seems like a bad idea since people aren't able to copy it. I'd say just post it in github and provide external link if nothing else works.

Select as Best AnswerUndo Best Answer

user
Downunder35m (author)iceng2015-05-15

Fair enough, both ways work to some extend but it nothing but a poor (very poor) workaround.
A good forum or site like this simply needs a build in function for adding any form of text without the editor messing with it.
The editing options so far are just sub standard for any type of forum :(

Select as Best AnswerUndo Best Answer

user
Downunder35m (author)2015-05-14

Was wondering the same a few times, more to add some HTLM or similar so it can be seen and used by others.
Seems there is no way to add any form of code without it either being converted into Instructable text or being converted into links or similar.
Especially for the Arduino guys it would be helpful to have at least a scrollable text box that it unaffected by the editor functions.

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)2015-05-14

They broke the system....

Select as Best AnswerUndo Best Answer