Display image inline using Doxygen - html

I'm using Doxygen to generate an html user manual from markdown files. I'd like to give instructions such as "Click on the [image.png] button" and have the png image appear in the line of text in the generated html.
According to Doxygen's documentation, images can be added as follows:
\image['{'[option]'}'] <format> <file> ["caption"] [<sizeindication>=<size>]
The documentation also says that "Currently only the option inline is supported. In case the option inline is specified the image is placed "in the line", when a caption s present it is shown in HTML as tooltip (ignored for the other formats)." This sounds like what I want to do.
I've tried several variations of the \image command with no luck. These successfully produce an image, but on its own line:
!["caption"](image.png)
\image html image.png "caption"
and these commands fail:
\image inline html image.png "caption"
\image{inline} html image.png "caption"
Does anyone know if it's possible to do what I'm trying to achieve? Am I just getting the syntax wrong?

The {inline} option with the \image command is introduced in version 1.8.15
The version:
\image{inline} html image.png "caption"
does work in 1.8.15.
OP used an older version and will have got warnings like:
warning: image type inline specified as the first argument of inline
is not valid warning: expected whitespace after { command

I was having this problem too. This line fixed it for me:
\image html name.png width=800cm height=600cm

Related

How to set an anchor in Markdown File

I want to set an anchor in a .md file. The file is in the Team Foundation Server but the tag <a name="anchor"></a> does not work. Are there any other possibilities to set an anchor in a .md file?
I already tried the following:
Link to an anchor
[Question 22](answers.md#answer22)
Setting an anchor
<a name="answer22"></a> This is an answer for Question 22
The result is that clicking on "Question 22" the file answers.md is opened successfully but isn't "hopping" to Question 22. Furthermore the tag <a name="answer22"><a/> doesn't seem to be recognized as Code in the md. File in the TFS. If I open the File answer22.md and look at the preview (in TFS you can switch between "contents", "preview", "history" etc.) the tag is not hidden and you can see it in the preview as if it is just plain text.
As stated in Microsofts basic Markdown guidance, anchors are generated for every heading.
Just place your answer below a heading.
questions.md
[Question22]9(./answers.md#answer-22)
answers.md
## Answer 22
The answer is 42
See the Markdown Guide, Extended Syntax: Linking to Heading IDs.
This markdown:
[Heading IDs](#heading-ids)
Should be rendered to following HTML by most supported engines:
Heading IDs
Where the text of the headings serves as anchor-name in slug form (spaces converted to hyphens).
In Pandoc Markdown you can set anchors on arbitrary spans inside a paragraph using syntax [span]{#anchor}, e.g.:
[This is an answer for question 22]{#answer-22}
And then reference it as usual: [Question 22](#answer-22).
If you want to reference a whole paragraph then formally it's not possible but you can make a simple hack adding an empty span right in the beginning of the paragraph:
[]{#answer-22}
Paragraph text.

Using an Image as a Link in AsciiDoc

I'm trying to create a "clickable" image in AsciiDoc lightweight markup language with Asciidoctor.
I tried the following (not working):
image::<url1>[<url2>[]]
For example:
image::https://img.shields.io/badge/License-Apache%202.0-blue.svg[http://www.apache.org/licenses/LICENSE-2.0[]]
It should become roughly the following html:
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg">
How can I accomplish this in AsciiDoc without passing through raw HTML?
block:
image::https://img.shields.io/badge/License-Apache%202.0-blue.svg[link="http://www.apache.org/licenses/LICENSE-2.0"]
inline:
image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[link="http://www.apache.org/licenses/LICENSE-2.0"]
Notice the link attribute on the image.

How can I eliminate the empty line in code blocks rendered by jekyll?

GitHub Pages Jekyll use Pygments by default to render syntax highlighting for code blocks. But I prefer an easier alternative highlight.js to do the job because I only need to indent 4 spaces to mark code blocks in the markdown source files.
However, my R code are all mistakenly interpreted as php or perl or makefile or other type of code by highlight.js, and I want to manually mark the code block by
```r
(some r code)
```
instead. But when I use this, the first line of the code block always appears to be a blank line. I view the HTML source code produced by the 4-space mark, it is like
<pre><code>x <- rnorm(100)
y <- 2*x + rnorm(100)
lm(formula=y~x)
</code></pre>
which does not suffer from this problem.
How can I eliminate the blank line in the first line of the code block?
I face the same issue today when I change my highlighter to highlight.js.
With the help from others, I finally git rid of this blank line, and willing to share the solution. Basically, the whitespace inside <pre> is not trimmed, and be treated as a newline in the rendered page (you can use firebug extension of Firefox enabled with show whitespace to observe the extra line).
Then the solution is obvious.
put pre and code tags at the same line with your actual code. like this:
<pre><code class="css">#font-face {
font-family: Chunkfive; src: url('Chunkfive.otf');
}
or using solution provided by mhulse to make your raw post more readable
<pre><code
>line of code
Here and ...
Here
</code></pre>
Write your own js code to trim L/R whitespace(s) of your content before it be put in <pre>
For more details, check this page.

sphinx, restructuredtext: set color for a single word

Is there a way to set the color of single words (or characters) in sphinx? I'm pretty sure there should be some markup tag, like HTML's font tag.
On my Sphinx-powered website, I use a combination of:
A restructuredText file containing roles definitions, one for each color - see .special.rst (BitBucket link)
A CSS file containing color rules for each role - see the first lines of hacks.css (BitBucket link)
Then, in every rST file where I need colors, I first import .special.rst at the top, either manually:
.. include:: .special.rst
Or with the rst_epilog configuration variable in Sphinx's conf.py file:
rst_epilog = "\n.. include:: .special.rst\n"
And then each role can be used easily in pure rST syntax:
This is :red:`red !` And :blue:`this part is blue`.
More details are given on this page (in French, sorry).
It works perfectly well for html output (and html-like), but not for PDF. Refer to the first answer above for producing a PDF with colors.
If you want to do this without being tied to html, try applying a different style than normal body text to your word.
In this example adapted from the rst2pdf manual, I apply the existing rubric style which is red in the backend that I am using:
Before red.
.. role:: rubric
I like color :rubric:`rubric`.
After red.
The actual look of the word will depend on how the style you choose is defined in the stylesheet that you use when generating your document.
If you want blue text, make a blue text style and derive it from the normal text style.
The stylsheet is backend-specific and you may be using the default.
To print the default for rst2pdf.py, do this (from the rst2pdf manual):
rst2pdf --print-stylesheet
Continuing the example for a rst2pdf stylesheet, add this to your stylesheet to have a blue text style:
bluetext:
parent: bodytext
textColor: blue
In the document you can reference this style to get a blue word.
Note this bit is generic, and should make blue text if you define a blue style in your html or whatever backend's stylesheet.
Before blue.
.. role:: bluetext
I like color :bluetext:`blue`.
After blue.
The generated pdf has the coloured words:
Sphinx already supports colors with the s5defs.txt standard definition file intended for inclusion (but is missing the CSS file):
Create/append this text to the value of rst_epilog
sphinx configuration, in your docs/conf.py file:
rst_prolog = """
.. include:: <s5defs.txt>
"""
Follow Sphinx's instructions to add a css with the colors
(e.g. adopt the hack.css from #Næreen's answer):
Place your css file into e.g. _static/css/s4defs-roles.css;
append it's path into shtml_css_files sphinx configuration:
html_css_files = ['css/s4defs-roles.css']
You may then use:
Some :red:`colored text` at last!
TIP:
Read this SO if you also want the styling to appear in Latex output.
This works, but leaves the HTML in a separate paragraph.
.. raw:: html
<font color="blue">Blue word,</font>
And a word without color
If anyone has a better answer, I will accept it.
Just a quick note because I landed here looking for something similar for html.
This works on Sphinx v2.0.1 for me. This uses the concept reported by #adam-matan but doesn't cause any formatting issues (i.e. the paragraph problem).
reference: reStructuredText Directives
.. role:: raw-html(raw)
:format: html
:raw-html:`<font color="blue">Blue word,</font>` And a word without color

How to add animated (html+css) text to HomeSlider images in Prestashop

I want to add some animated text (HTML&CSS based) on HomeSlider images. I have tried this by adding html code to description field in HomeSlider module configuration and placed the css code in homeslider.css file but the animation text is nowhere showing. How to achive this correctly?
Try disable Html purifier option,also see that your html code to not be more that 4000 characters.If still not working try edit file HomeSlide.php in line description change isCleanHtml with isString >> Save and reset module.