The getContent()
JavaScript method returns the HTML content of the currently open topic. It is only available in the Topic template designer.
It corresponds to the Get the content of an HTML section web service.
Example
The following example prints the HTML content of the currently open topic in the user's browser console.
async function getTopicContent() {
try {
const content = await topic.getContent();
console.log(content);
} catch (error) {
console.error("Error fetching topic content:", error);
}
}
// Call the function to get the topic's HTML content
getTopicContent();