Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asciidoctor.loadFile and convert has no css #1729

Closed
virtualdreams opened this issue Apr 25, 2024 · 2 comments
Closed

asciidoctor.loadFile and convert has no css #1729

virtualdreams opened this issue Apr 25, 2024 · 2 comments

Comments

@virtualdreams
Copy link

Hello,

I don't know what's wrong, but there is no stylesheet in the produced HTML.
However, when I render from a string, a stylesheet is also included.

const asciidoctor = require('asciidoctor')
const ad = asciidoctor()

// has no stylesheet link
var doc = ad.loadFile(file, { safe: 'unsafe' })
var html = doc.convert({ standalone: true, attributes: { stylesdir: '/static/' } })

// has a stylesheet link
var html = ad.convert('= Welcome\n\nHello, _AsciiDoctor_', { standalone: true, attributes: { 'stylesdir': '/static/' } }

Why?

@virtualdreams virtualdreams changed the title asciidocter.loadFile and convert has no css asciidoctor.loadFile and convert has no css Apr 25, 2024
@ggrossetie
Copy link
Member

Did you try to move the options in the loadFile function?

var doc = ad.loadFile(file, { safe: 'unsafe', standalone: true, attributes: { stylesdir: '/static/' } })
var html = doc.convert()

As far as I recall, some options/attributes need to be defined on the Document (and will be "ignored" when calling convert on Document).

@ggrossetie
Copy link
Member

In the future, please direct questions to the project chat: https://asciidoctor.zulipchat.com/

@ggrossetie ggrossetie closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants