User Tools

Site Tools


en:resources:howtos:teachpress

How to work with teachpress

Template

You can find a template for the weekly assignments here.

Highlight code syntax

In order to publish syntax highlighted code in wordpress, type the following in your post editor view:

  • Insert: “[code lang=”<language>“]” where you want to insert code
  • Mark the line and assign “preformatted” as paragraph format
  • In the next line(s), enter your code or paste it as a whole (make sure, that you are still in the “preformatted” section.
  • Insert: “[/code]” at the end

For Python code use “Python” instead of <language>.

For R code use “R” instead of <language>.

Example for Python:

This is some text and now you want to enter code.
[code lang="Python"]
print "Hello"
for i in range[0,10]:
print i
[/code]
This is more text.
Everything from “[code lang…” to “…/code]” must be formated as “preformatted”

Include Rmd content

If you want to add html content created by the R markdown language to teachpress, one option would be the use of the RWordPress package. Since this package is (at the time of this writing) not available for the latest R version and to easy things up a little bit, we just go for the copy/paste approach.

  • Save the knitted html output of your Rmd file on your hard disk
  • Open the file using a text editor
  • Copy everything between <html> and </html> (i.e. everything from line 3 to the end)
  • Create a new post in teachpress and switch to the text mode of the editor (tab “text” on the upper right side of the text input window“
  • Paste the content from your HTML file into the window
  • Adjust your categories as usual and publish it
en/resources/howtos/teachpress.txt · Last modified: 2022/03/13 19:16 by 127.0.0.1