slatedocs / slate

Beautiful static documentation for your API
https://slatedocs.github.io/slate
Apache License 2.0
36k stars 84 forks source link

Question: images instead of code ? #846

Closed jcelerier closed 7 years ago

jcelerier commented 7 years ago

Hello,

Is it possible to use images instead of code snippets for documentation ? This is because some programming languages are graphical in nature: for instance Max/MSP, TouchDesigner, Scratch...

Thanks for the great software.

4cruz commented 7 years ago

I was wondering same question.

pnerger commented 7 years ago

Yes, you can use images. But you need to do it with the ">" annotation markdown rather than the "```" code block markdown. The reason for this, is that if you place it in the code block, the markdown is not processed and thus you won't see your image but simply the code for placing the image. But since the ">" annotation does process markdown, the image will appear.

We do this all the time for graphical programming languages.

Paul

jcelerier commented 7 years ago

But since the ">" annotation does process markdown, the image will appear.

mh... where should I put the programming language name in this case ?

e.g.

```foo ```

becomes

> ![image](link)... ?

pnerger commented 7 years ago

You can't put a programming langugate on a > as there is no mechanism for that. Thus it will come across in all tabs. We only use a single tab on visual programming language documents.

Surprised that the markdown for image did not work, it's been awhile since I did one. Have you tried explicit HTML?

4cruz commented 7 years ago

It worked, I was doing something wrong. Thanks for the help 👍

pnerger commented 7 years ago

Great!

jcelerier commented 7 years ago

Thus it will come across in all tabs. We only use a single tab on visual programming language documents.

ah, too bad :( I target two different visual languages.

Have you tried explicit HTML?

yep, this works

lord commented 7 years ago

@jcelerier if you give your explicit HTML image the right class, the language switching code should pick up on it.

<img src="blah" class="lang-specific ruby">

for instance should only appear when the Ruby language tab is selected.