<commit_before>'use strict';

/**
 * @description Returns a processed OpenAPI type name to handle array of objects [OpenAPI Type]
 * @param {String} openapiType The type
 * @return {String} The true OpenAPI type name
 */
function getOpenapiTypeName(openapiType) {
  return openapiType.replace('[', '').replace(']', '');
}

/**
 * @description Generate anchor (to find documentation in the specification) for OpenAPI type (handle [OpenAPI Type])
 * @param {String} openapiType The type
 * @return {String} The anchor
 */
function getAnchorForType(openapiType) {
  var typeName = openapiType.replace(/ /g, '').replace('[', '').replace(']', '');
  return typeName.charAt(0).toLowerCase() + typeName.slice(1);
}

/**
 * @description Generate documentation URL for OpenAPI type (handle [OpenAPI Type]) or anchor
 * @param {String} openapiType The type
 * @param {String} anchor The anchor
 * @param {String} specificationUrl The specification URL
 * @return {String} The documentation URL
 */
function getDocumentationUrl(openapiType, anchor, specificationUrl) {
  var documentationUrl;
  if (anchor !== undefined) {
    documentationUrl = specificationUrl + anchor;
  }
  else if (openapiType !== null) {
    documentationUrl = specificationUrl + getAnchorForType(openapiType);
  }
  return documentationUrl;
}

var pRegEx = new RegExp('^<p>.*');

/**
 * @description Generate HTML for Markdown
 * @param {String} md The Mardown
 * @return {String} The HTML
 */
function getHTMLFromMD(md) {
  var html;
  if (md !== undefined && md !== null) {
    html = marked(md);
    //if (pRegEx.test(html)) {
      //html = html.substring(3, html.length - 5);
    //}
    //if (html.startsWith('<p>')) {
    //  html = html.substring(3, html.length - 5);
    //}
    
  }
  else {
    html = md;
  }
  return html;
}<commit_msg>Add target blank to links when transforming md to html<commit_after>'use strict';

/**
 * @description Returns a processed OpenAPI type name to handle array of objects [OpenAPI Type]
 * @param {String} openapiType The type
 * @return {String} The true OpenAPI type name
 */
function getOpenapiTypeName(openapiType) {
  return openapiType.replace('[', '').replace(']', '');
}

/**
 * @description Generate anchor (to find documentation in the specification) for OpenAPI type (handle [OpenAPI Type])
 * @param {String} openapiType The type
 * @return {String} The anchor
 */
function getAnchorForType(openapiType) {
  var typeName = openapiType.replace(/ /g, '').replace('[', '').replace(']', '');
  return typeName.charAt(0).toLowerCase() + typeName.slice(1);
}

/**
 * @description Generate documentation URL for OpenAPI type (handle [OpenAPI Type]) or anchor
 * @param {String} openapiType The type
 * @param {String} anchor The anchor
 * @param {String} specificationUrl The specification URL
 * @return {String} The documentation URL
 */
function getDocumentationUrl(openapiType, anchor, specificationUrl) {
  var documentationUrl;
  if (anchor !== undefined) {
    documentationUrl = specificationUrl + anchor;
  }
  else if (openapiType !== null) {
    documentationUrl = specificationUrl + getAnchorForType(openapiType);
  }
  return documentationUrl;
}

/**
 * @description Add target="_blank" to all links in html
 * @param {String} html
 * @returns {String} Modified html 
 */
function addTargetBlankToURL(html) {
  var result = html;
  result = result.replace(/<a href=/g, '<a target="_blank" href=');
  return result;
}

/**
 * @description Generate HTML for Markdown
 * @param {String} md The Mardown
 * @return {String} The HTML
 */
function getHTMLFromMD(md) {
  var html;
  if (md !== undefined && md !== null) {
    html = marked(md);
    html = addTargetBlankToURL(html)    
  }
  else {
    html = md;
  }
  return html;
}
{'fraction_non_alphanumeric': 0.13802291500133226, 'fraction_numerical': 0.0021316280309086064, 'mean_word_length': 4.107482993197279, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1751823', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1120, 'n_words': 359}