All files / src/custom-markdown-it-features html5-embed.ts

75% Statements 6/8
50% Branches 1/2
50% Functions 1/2
85.71% Lines 6/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32    1x   1x   1x                       1x 1x 1x                      
// tslint:disable-next-line no-implicit-dependencies
import { MarkdownIt } from "markdown-it";
import { resolve } from "path";
import { MarkdownEngineConfig } from "../markdown-engine-config";
import { extensionDirectoryPath } from "../utility";
 
const optionsFromConfig = (config: MarkdownEngineConfig) => ({
  html5embed: {
    useImageSyntax: config.HTML5EmbedUseImageSyntax,
    useLinkSyntax: config.HTML5EmbedUseLinkSyntax,
    isAllowedHttp: config.HTML5EmbedIsAllowedHttp,
    attributes: {
      audio: config.HTML5EmbedAudioAttributes,
      video: config.HTML5EmbedVideoAttributes,
    },
  },
});
 
export default (md: MarkdownIt, config: MarkdownEngineConfig) => {
  Eif (!config.enableHTML5Embed) {
    return;
  }
 
  md.use(
    require(resolve(
      extensionDirectoryPath,
      "./dependencies/markdown-it/extensions/markdown-it-html5-embed.js",
    )),
    optionsFromConfig(config),
  );
};