_includes/static_comments.html in jekyll-theme-mehdix-rtl-1.0.0 vs _includes/static_comments.html in jekyll-theme-mehdix-rtl-1.1.0
- old
+ new
@@ -2,12 +2,12 @@
{% endcapture %}
<section id="static-comments">
{% capture key %}{{ page.id | remove_first: "/" }}{% endcapture %}
{% assign comments = site.data.comments[key] %}
{% if comments %}
+ <h4 id="comments-header">نظرات خوانندگان</h4>
<div id="comments">
- <h4 id="comments-header">نظرات خوانندگان</h4>
{% for comment in comments %}
<article>
<div class="comment-image-wrapper">
<img class="comment-avatar" src="https://www.gravatar.com/avatar/{{comment.email}}?s=200&d=robohash" />
</div>
@@ -18,27 +18,28 @@
<a href={{comment.website}}>{{ comment.name }}</a>
{% else %}
{{ comment.name }}
{% endif %}
</small>
- <small class="meta"> {{ comment.date | jdate: "%d %b %Y" | habify }}</small>
+ <small> {{ comment.date | jdate: "%d %b %Y" | habify }}</small>
</span>
{{ comment.message | replace: "<p>", '' | replace: "</p>", newLine | replace: "<br>", newLine | strip_html | markdownify }}
</div>
</article>
{% endfor%}
</div>
{% endif %}
- <form id="comment-form" name="comment" netlify>
+ <form id="comment-form" name="comment" netlify-honeypot="bot-field" netlify>
<input name="bot-field" style="display:none">
<input name="page_id" style="display:none" value="{{page.id}}">
<input name="page_uuid" style="display:none" value="{{page.uuid}}">
<input name="page_date" style="display:none" value="{{page.date}}">
<input name="page_title" style="display:none" value="{{page.title}}">
- <label for="message">دیدگاه<sup class="required">*</sup> <small>میتوانید با<a href="http://commonmark.org/help/">مارکداون</a> هم بنویسید.</small>
- <textarea id="message" name="message" required alt="no!!"></textarea>
+ <label for="message">دیدگاه<sup class="required">*</sup> <small>میتوانید با <a href="http://commonmark.org/help/" target="_">مارکداون</a> هم بنویسید.</small>
+ <textarea id="message" name="message" required alt="no!!" onkeyup="preview()"></textarea>
+ <div id="preview"></div>
</label>
<label for="name">نام<sup class="required">*</sup>
<input id="name" type="text" name="name" required>
</label>
<label for="email">ایمیل<sup class="required">*</sup>
@@ -50,6 +51,15 @@
<div style="text-align:left">
<button type="submit" class="button">ارسال</button>
</div>
</form>
-</section>
+</section>
+<script src="{{ 'assets/js/showdown.min.js' | absolute_url }}" type="text/javascript">
+</script>
+<script type="text/javascript">
+ function preview(){
+ var converter = new showdown.Converter();
+ var markdown = document.getElementById("message").value;
+ document.getElementById("preview").innerHTML = converter.makeHtml(markdown);
+ }
+</script>
\ No newline at end of file