Title: Displaying code
Last modified: October 12, 2017

---

# Displaying code

 *  Resolved [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/)
 * I have a strange issue and I don’t know where the fault lies.
 * According to this:
 * [https://en.support.wordpress.com/code/posting-source-code/](https://en.support.wordpress.com/code/posting-source-code/)
 * I should be able to show source code.
 * I have also asked this here:
 * [https://stackoverflow.com/questions/46718436/showing-source-code-in-a-wordpress-blog-post](https://stackoverflow.com/questions/46718436/showing-source-code-in-a-wordpress-blog-post)
 * In short, I can’t display source code.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdisplaying-code-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/displaying-code-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/displaying-code-2/page/2/?output_format=md)

 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582269)
 * Update:
 * I changed to a plug in CodeColorer:
 * [https://kpumuk.info/projects/wordpress-plugins/codecolorer/#faq](https://kpumuk.info/projects/wordpress-plugins/codecolorer/#faq)
 * If I use the syntax outside a table it is fine. But in a table cell it is not:
 * [http://blog.publictalksoftware.co.uk/2017/10/10/changes-to-the-midweek-editor-from-january-2018/](http://blog.publictalksoftware.co.uk/2017/10/10/changes-to-the-midweek-editor-from-january-2018/)
 * Is this issue with your plugin or codecolorer?
 *  [Dmytro Shteflyuk](https://wordpress.org/support/users/kpumuk/)
 * (@kpumuk)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582280)
 * Hi! I don’t see an example of a CodeColorer snippet in a table cell on that page.
   Did you remove it or am I missing something?
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582322)
 * Look at it now.
 * 1. Everytime I update my post the code is reformatting and I am losing new lines.
   This could be a markdown plug I am using. I will try to disable tomorrow to test.
 * 2. The code snippet is the same in the table and in the post. One works and one
   doesn’t.
 *  [Dmytro Shteflyuk](https://wordpress.org/support/users/kpumuk/)
 * (@kpumuk)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582325)
 * Are you using a plugin to insert tables? Tablepress maybe? I have never tested
   it…
 *  [Dmytro Shteflyuk](https://wordpress.org/support/users/kpumuk/)
 * (@kpumuk)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582330)
 * Thank you for reporting. I see couple issues with highlighting, which are XML
   specific (closing tag has a different color), line highlighting for solarized-
   dark (too bright yellow), and this issue with a table. Will check all of those.
 * Anything else I am missing?
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582333)
 * I think that was it. And yes it is in tablepress
 *  [Dmytro Shteflyuk](https://wordpress.org/support/users/kpumuk/)
 * (@kpumuk)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582572)
 * Alright, I have released CodeColorer 0.9.12 with support for TablePress. Could
   you try it?
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9582884)
 * Thanks for looking so quickly. ☺️ Things much better!
 * Two questions:
 * Firstly, I tried to set the code block to use the full **width** in the cell 
   so that it did not bleed. I tried using **settings**. The notes refer to **percent
   suffix **but it insisted on me just putting in **whole integers** and no suffix.
   That an issue? In the end I reduced the value as 300 which looks ok to me but
   is there a better/ safer way?
 * Secondly, I notice that the code in the table now has a lot of **br** codes which
   should not be there. When I get back from my first job I will try putting the
   code in again. But in your tests was it ok? Should I be able to get that to work
   properly?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583152)
 * Hi everybody!
 * Good to see that there’s already a good discussion going on here!
 * If you guys find that anything needs to be changed in TablePress, please let 
   me know.
 * Regarding those linebreaks: These might be coming from TablePress. To remove 
   them, please try using this modified Shortcode on that page:
 *     ```
       [table id=123 convert_line_breaks=false /]
       ```
   
 * (with the correct table ID).
 * Regards,
    Tobias
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583260)
 * Thanks for your help and we are making progress friends.
 * I have added the convert_line_breaks call. In addition, I had to deactivate my
   WP-Markdown plugin because everytime I updated my native post the formatting 
   was changing. Maybe there is a way to handle that but it is outside the scope
   of this conversation.
 * These are my findings:
 * On my PC it looks good:
 * [https://www.dropbox.com/s/w3pium73waxzcpk/IMG_0656_PC.JPG?dl=0](https://www.dropbox.com/s/w3pium73waxzcpk/IMG_0656_PC.JPG?dl=0)
 * But on my iPad:
 * [https://www.dropbox.com/s/6r9gdjdj4jpcsx9/IMG_0654_IPad.JPG?dl=0](https://www.dropbox.com/s/6r9gdjdj4jpcsx9/IMG_0654_IPad.JPG?dl=0)
 * And on my iPhone:
 * [https://www.dropbox.com/s/uejjlj3dlgemguh/IMG_0655_IPhone.PNG?dl=0](https://www.dropbox.com/s/uejjlj3dlgemguh/IMG_0655_IPhone.PNG?dl=0)
 * I see two problems:
 * 1. Why is the colouring of the code inside the table not the same? It is on the
   PC but not on the mobile devices.
 * 2. Even though I have specifically used width=”100%” in the code , it has pushed
   the width out. I except I have to compromise. I am not a web guru so I don’t 
   know what is excepted behaviour across devices. Thoughts?
 * The only other issue so far is on the preview page where the post is listed at
   the top. It looks like this:
 * [https://www.dropbox.com/s/qim5nbufqaofxw7/Preview.jpg?dl=0](https://www.dropbox.com/s/qim5nbufqaofxw7/Preview.jpg?dl=0)
 * Bit messy. 🙂
 * Finally, having removed the code image from the post, I can’t work out how to
   have a gap between the text and the code.
    -  This reply was modified 8 years, 6 months ago by [Chuckie](https://wordpress.org/support/users/ajtruckle/).
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583295)
 * Hi,
 * unfortunately, I don’t know the Code plugin well enough to be able to help with
   that, sorry.
 * As for the preview page: That now is is a theme thing. Your there apparently 
   isn’t showing the full page content there, but only an automatically created 
   excerpt (i.e. short version) of the content, and this never has full styling.
 * Regards,
    Tobias
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583309)
 * Thanks Tobias. I await comments from Dmytro … 🙂 Knock this on the head!
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583329)
 * Tobias, I do have a problem related to TablePress. If I use convert_line_breaks
   =false then it strips out ALL of my places where I want blank lines through the
   whole post.
 * But if I remove that flag then the code will start to show the br tags again.
   🙁
 * I need to be able to show new lines not not that the br tags in the code block.
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583336)
 * Hi,
 * that’s indeed the dilemma here. For not having the `<br />` tags, adding the 
   Shortcode parameter is the only way.
 * But for adding the new lines, you now have an extra manual way: Just add a `<
   br />` tag in the desired places.
 * (As you can see, we might be reaching a point where using a table for layout 
   purposes is no longer a good thing.)
 * Regards,
    Tobias
 *  Thread Starter [Chuckie](https://wordpress.org/support/users/ajtruckle/)
 * (@ajtruckle)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/#post-9583348)
 * Great! I did that Tobias. I have removed the rows from the table and added them
   directly to the post and now all is good on both the PC and the iPad. I assume
   the iPhone too. 🙂
 * Fantastic! I await for Dmytro to offer any comments before this is closed.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/displaying-code-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/displaying-code-2/page/2/?output_format=md)

The topic ‘Displaying code’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [source-code](https://wordpress.org/support/topic-tag/source-code/)

 * 16 replies
 * 3 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/displaying-code-2/page/2/#post-9583367)
 * Status: resolved