1

I'm using DITA-OT 3.0.4.

I'm trying to convert my markdown file to html5 with the following command.

dita --input="note.ditamap" --output="out" --format=html5 --args.css=style.css --args.cssroot=metadata --args.copycss=yes --args.csspath=css

And I have these directory structure.

├── note.ditamap
├── metadata
│   ├── note.properties
│   └── style.css(this is my custom CSS)

As a result of the above command, converting is succeeded, but the output html(i.e. index.html) did not contain the custom CSS.

I also tried with these command and properties, but the result is the same as before.

dita --input="note.ditamap" --output="out" --format=html5 --propertyfile="metadata/note.properties"

Here is the note.properties content.

args.csspath = css
args.copycss = YES
args.css = style.css
args.cssroot = metadata

I found output html refers ${DITA_INSTALL_DIR}/dita-ot-3.0.4/plugins/org.dita.html5/css/commonltr.css, so I appended my CSS to it and my expected output is coming, but I think it is not good because these changes will affect all other projects.

I checked some documents and issues on GitHub, but I could not find the solution yet. Do you have any suggestion?

References:

tkhm
  • 860
  • 2
  • 10
  • 30

1 Answers1

1

Your "args.cssroot" is given as a relative location "metadata". The documentation for the parameter states something like:

   The value you enter here will be interpreted relative to the location of the input map file.

but from what I looked in the build files this is not true, the relative location seems to be relative to the current folder where the publishing process started (which is probably the "DITA-OT\bin"). So maybe you could try to pass args.cssroot as an absolute path, see if it works better for you.

Usually in such cases instead of passing the args.cssroot I pass directly the "args.css" as an absolute path, this also seems to work for me.

Radu Coravu
  • 1,754
  • 1
  • 9
  • 8
  • 1
    I added an issue for this on the DITA OT issues list: https://github.com/dita-ot/dita-ot/issues/2965 – Radu Coravu May 18 '18 at 06:32
  • Thanks again. I understand I need to pass the absolute path at this moment. It's much better. In addition, thank you for adding the issue, I really appreciate it. Thank you so much. – tkhm May 18 '18 at 08:44