{"size": 1331, "ext": "js", "max_stars_repo_path": "packages/legacy-editor-to-editor/src/markdownToHtml.js", "max_stars_repo_name": "serlo-org/athene2-assets", "max_stars_repo_stars_event_min_datetime": "2017-10-26T16:31:51.000Z", "max_stars_repo_stars_event_max_datetime": "2017-11-17T09:02:36.000Z", "max_issues_repo_path": "packages/legacy-editor-to-editor/src/markdownToHtml.js", "max_issues_repo_name": "serlo/athene2-assets", "max_issues_repo_issues_event_min_datetime": "2019-01-14T09:12:34.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-10T13:10:07.000Z", "max_forks_repo_path": "packages/legacy-editor-to-editor/src/markdownToHtml.js", "max_forks_repo_name": "serlo/athene2-assets", "max_forks_repo_forks_event_min_datetime": "2017-11-24T16:44:23.000Z", "max_forks_repo_forks_event_max_datetime": "2018-02-15T12:52:27.000Z"}
{"max_stars_count": 2, "max_issues_count": 19, "max_forks_count": 3, "avg_line_length": 34.1282051282, "max_line_length": 93, "alphanum_fraction": 0.675432006}
/**
 * This file is part of Athene2 Assets.
 *
 * Copyright (c) 2017-2019 Serlo Education e.V.
 *
 * Licensed under the Apache License, Version 2.0 (the "License")
 * you may not use this file except in compliance with the License
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @copyright Copyright (c) 2013-2019 Serlo Education e.V.
 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://github.com/serlo-org/athene2-assets for the canonical source repository
 */
import { converter } from '@serlo/markdown'

const renderMarkdown = input => {
  let html = converter.makeHtml(input)
  html = html.replace(/"/gm, '"')
  return html
    .replace(
      /<span class="mathInline">%%(.*?)%%<\/span>/gm,
      '<katexinline>$1</katexinline>'
    )
    .replace(
      /<span class="math">\$\$(.*?)\$\$<\/span>/gm,
      '<katexblock>$1</katexblock>'
    )
    .replace(/\r?\n/gm, '')
}
export default renderMarkdown
