MarkDown and ghostwriter


#1

I am not sure if anyone here can help me with this: I am writing some program documentation to [maybe] appear on github. I know that Markdown documents [such as this] can contain code boxes containing C code, which are scrollable vertically by the reader if they are too big to display inline.

I have searched the internet for Markdown or underlying HTML examples of how to best do this but I can’t find the answer. I have ghostwriter and this forum to test things [without actually posting anything!], but am lost.

Thanks, jack


(Max) #2

I think not all markdown-flavours support syntax highlighting. Github-Flavoured Markdown does support it though.
Here is the relevant website: Creating and highlighting Code Blocks

I hope this is what you were looking for. :slight_smile:


tl;dr
You just use a normal code-fence. If the language is not recognized automatically by github, you can specify it (this example is for python):

```Python
print("Hello")
```

The output would be:

print("Hello")

#3

Fyrenic: thanks, but I need to scroll through a 200 line C program, of which only [say] 30 lines appear on the screen. I know that this is possible as one of my documents was put into this form for me, but I no longer have access to the original Markdown source.


(Max) #4

Oh. Well 200 Lines would be problematic like this. :frowning:
After searching around a bit I found this in a Stackoverflow thread.

I don’t know much at all about html so take it with a grain of salt. :smiley:
But I think it does what you want:

<textarea style="resize:none" readonly rows="30" cols="50">

Your Stuff here

</textarea>

(Kevin Moses) #5

GitHub uses Jekyll and Jekyll uses kramdown.

If you’re going to write github pages I suggest you look into Jekyll. Jekyll requires Ruby and Rubygems.


#6

Thanks, <textarea> works well with <pre> to achieve what I want for my documents. It is a worry that I must dynamically adapt to the requirments of the latest github fad. Maybe I will skip github [having not yet used it], and try Gitlab instead. What are those README.md github files about, if not mARKdOWN?


(Max) #7

Since you said you use ghostwriter for markdown and not a plaintext-editor:

For me Ghostwriter put paragraph tags in when I copied text with blank lines into the textarea and then exported it as html. Same goes for when you use pandoc.

Those will show up in the generated html. :confused:
Of course you can circumvent that by editing them out with a plaintext-editor. But this really isn’t an optimal solution.

The best solution would probably be what @Kevin said. :slight_smile:


#8

I am only using ghostwriter to see what Markdown does to my text+directives, but I would normally use the “ex” or “leafpad” text editors to create content [old school].


(Kevin Moses) #9

You should really set up a Jekyll environment. There are a few gotchas. I’m willing to help you set it up. Because it is kinda knowledge intensive as far as that goes.

The main gotchas are making sure you have Ruby in the path.
And understanding the difference between the bundler and bundle commands.
The bundle command is used to update the gem files.
The first thing you will need to do is update the gemlock file to include the latest version of Jekyll and fileutilis.
However once you have this setup, you are able to run a local environment and have it updating in real time.
It’s pretty damn sweet.


#10

Thanks Kevin, but I am bombarded with new things to learn, and the more you write about Jekyll the more I want to hyde! My life, these days, is about finding/creating simple, open source solutions to my problems.

For example, I would consider Firefox “closed source”, since its mind-blowing size [millions of lines of code] puts it in the domain of big organizations. It is good to know that lots of smart engineers all over the world are working hard on Firefox, Linux etc, but to me these projects may as well be closed.