Skip to content

Commit

Permalink
(#678 , #680)feat: add ability for asciidocParser to pass the krokiSe…
Browse files Browse the repository at this point in the history
…rverUrl (#701)
  • Loading branch information
haydencbarnes authored Feb 11, 2023
1 parent aad725f commit fba9fb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/asciidocParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ export class AsciidocParser {

// Antora IDs resolution:
const antoraDocumentContext = await getAntoraDocumentContext(doc.uri, context.workspaceState)
// load the Asciidoc header only to get kroki-server-url attribute
const document = processor.load(text, { header_only: true })
const krokiServerUrl = document.getAttribute('kroki-server-url') || 'https://kroki.io'

const asciidoctorWebViewConverter = new AsciidoctorWebViewConverter(
doc,
Expand All @@ -153,7 +156,8 @@ export class AsciidocParser {
this.contributionProvider.contributions,
previewConfigurationManager.loadAndCacheConfiguration(doc.uri),
antoraDocumentContext,
line
line,
krokiServerUrl
)
processor.ConverterFactory.register(asciidoctorWebViewConverter, ['webview-html5'])

Expand Down
3 changes: 2 additions & 1 deletion src/asciidoctorWebViewConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export class AsciidoctorWebViewConverter {
previewConfigurations: AsciidocPreviewConfiguration,
private readonly antoraDocumentContext: AntoraDocumentContext | undefined,
line: number | undefined = undefined,
state?: any
state?: any,
private readonly krokiServerUrl?: string
) {
const textDocumentUri = textDocument.uri
this.basebackend = 'html'
Expand Down

0 comments on commit fba9fb7

Please sign in to comment.