diff --git a/worker/src/util/adoc2html.ts b/worker/src/util/adoc2html.ts index a2524ae93e..e93681c0b2 100644 --- a/worker/src/util/adoc2html.ts +++ b/worker/src/util/adoc2html.ts @@ -142,13 +142,14 @@ class FranklinConverter implements AdocTypes.Converter { section: (node) => { const level = node.getLevel(); const title = node.getTitle(); + const id = node.getId(); const tag = `h${level + 1}`; const blocks = node.getBlocks() as AdocTypes.AbstractBlock[]; const closer = this.sectionDepth > 0 ? '' : ''; this.sectionDepth += 1; const content = ` - ${title ? `<${tag}>${title}` : ''} + ${title ? `<${tag}${!id.startsWith('_') ? ` id="${id}"` : ''}>${title}` : ''} ${blocks.map((block) => this.convert(block)).join('\n')}`; const wrapper = `${closer}
${content}${closer ? '' : '
'}`; @@ -268,7 +269,14 @@ class FranklinConverter implements AdocTypes.Converter { } const href = book.resolve(`/_graphics/${src}`); - return /* html */`${node.getAttribute('alt') as string || ''}`; + const sizes = []; + if (node.getAttribute('width')) { + sizes.push(`width="${node.getAttribute('width') as string}"`); + } + if (node.getAttribute('height')) { + sizes.push(`height="${node.getAttribute('height') as string}"`); + } + return /* html */`${node.getAttribute('alt') as string || ''}`; }, table: (node) => { const title = node.getTitle(); @@ -291,9 +299,9 @@ class FranklinConverter implements AdocTypes.Converter { makeBlock(name: string, content: string, variants: string[] = [], singleCell = false): string { const variantStr = variants.map(toClassName).join(' '); return /* html */` -
- ${singleCell ? '
\n' : ''}${content.trim()}${singleCell ? '\n
' : ''} -
`; + < div class="${toClassName(name)}${variantStr ? ` ${variantStr}` : ''}" > + ${singleCell ? '
\n' : ''}${content.trim()}${singleCell ? '\n
' : ''} + `; } tableToTableBlock(node: AdocTypes.Table): string {