<commit_before>{% extends "base.html" %}
{% block head %}
    <style>
        .board-repr {
            padding-left: 3px;
            border: 1px solid transparent;
            box-shadow: none;
        }
    </style>
    <link rel="stylesheet" href="/static/css/codemirror.css">
{% endblock %}
{% block body %}
    <div class="row">
        <form method="post">
            <div class="form-group">
                <label for="board">게시판</label>

                <div class="form-control board-repr" id="board">{{ board_repr }}</div>
		{% if mode == 'edit' %}
                <input name="id" type="hidden" value="{{ id }}"/>
		{% else %}
                <input name="name" type="hidden" value="{{ board_name }}"/>
		{% endif %}
            </div>
            <div class="form-group">
                <label for="subject">제목</label>
                <input name="subject" type="text" class="form-control" id="subject" placeholder="제목" value="{{ subject | e }}" required/>
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">내용</label>
                <textarea name="content" class="form-control" rows="20" required>{{ content }}</textarea>
            </div>
            <input type="submit" class="btn btn-default" value="완료"/>
        </form>
    </div>
{% endblock %}
{% block script %}
    <script>
        if ("{{ board_name }}" === "notice") {
            var notice_li = $("#notice");
            notice_li.addClass("active");
            notice_li.append("<span class=\"sr-only\">현재 선택됨</span>");
        } else {
            var board_li = $("#{{ board_name }}");
            board_li.parent().addClass("in");
            board_li.addClass("active");
            board_li.append("<span class=\"sr-only\">현재 선택됨</span>");
        }
    </script><commit_msg>#24 Add codemirror with markdown highlighting<commit_after>{% extends "base.html" %}
{% block head %}
    <style>
        .board-repr {
            padding-left: 3px;
            border: 1px solid transparent;
            box-shadow: none;
        }
        .CodeMirror {
            border: 1px solid #ccc;
            border-radius: 4px;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/markdown/markdown.min.js"></script>
{% endblock %}
{% block body %}
    <div class="row">
        <form method="post">
            <div class="form-group">
                <label for="board">게시판</label>

                <div class="form-control board-repr" id="board">{{ board_repr }}</div>
		{% if mode == 'edit' %}
                <input name="id" type="hidden" value="{{ id }}"/>
		{% else %}
                <input name="name" type="hidden" value="{{ board_name }}"/>
		{% endif %}
            </div>
            <div class="form-group">
                <label for="subject">제목</label>
                <input name="subject" type="text" class="form-control" id="subject" placeholder="제목" value="{{ subject | e }}" required/>
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">내용</label>
                <textarea name="content" class="form-control" rows="20" required>{{ content }}</textarea>
            </div>
            <input type="submit" class="btn btn-default" value="완료"/>
        </form>
    </div>
{% endblock %}
{% block script %}
    <script>
        if ("{{ board_name }}" === "notice") {
            var notice_li = $("#notice");
            notice_li.addClass("active");
            notice_li.append("<span class=\"sr-only\">현재 선택됨</span>");
        } else {
            var board_li = $("#{{ board_name }}");
            board_li.parent().addClass("in");
            board_li.addClass("active");
            board_li.append("<span class=\"sr-only\">현재 선택됨</span>");
        }
      var editor = CodeMirror.fromTextArea($('textarea[name=content]')[0], {
        lineNumbers: true,
        mode: 'text/x-markdown',
        styleActiveLine: true,
        lineWrapping: true
      });
      $('input[type=submit]').click(
        function() {
          $('textarea[name=content]')
            .val(editor.getValue());
        }
      )
    </script>
{'fraction_non_alphanumeric': 0.18624772313296903, 'fraction_numerical': 0.00546448087431694, 'mean_word_length': 2.01717032967033, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 73, 'https://': 3, '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': '1335353', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1368, 'n_words': 250}