diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-13 16:28:03 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-11-13 16:28:03 +0000 |
commit | 605254d8771e816d9f27c22547eed68fb4ff23d2 (patch) | |
tree | 7a17ddd68a060a31564446dbafcbcbfa2486a644 | |
parent | 6a5cd2255b409b956a2582e062b39131639a9564 (diff) |
Start implementing sx-question-mode--fill-string
Address #43
-rw-r--r-- | sx-question-mode.el | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sx-question-mode.el b/sx-question-mode.el index 686d357..c17d55a 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -97,6 +97,11 @@ If WINDOW is given, use that to display the buffer." "Face used on the question title in the question buffer." :group 'sx-question-mode-faces) +(defface sx-question-mode-title-comments + '((t :height 1.1 :inherit sx-question-mode-title)) + "Face used on the question title in the question buffer." + :group 'sx-question-mode-faces) + (defcustom sx-question-mode-header-title "\n" "String used before the question title at the header." :type 'string @@ -230,21 +235,36 @@ DATA can represent a question or an answer." (insert sx-question-mode-separator) (sx-question-mode--wrap-in-overlay '(face sx-question-mode-content-face) - (insert - (sx-encoding-clean-content .body_markdown) - "\n"))) + (insert "\n" + (sx-question-mode--fill-string + (sx-encoding-clean-content .body_markdown)) + sx-question-mode-separator))) ;; Comments (when .comments (insert "\n" (propertize sx-question-mode-comments-title - 'font-lock-face 'sx-question-mode-title + 'font-lock-face 'sx-question-mode-title-comments 'sx-question-mode--section 3)) (sx-question-mode--wrap-in-overlay '(sx-question-mode--section-content t) (insert "\n") - (mapc #'sx-question-mode--print-comment .comments))))) + (sx-question-mode--wrap-in-overlay + '(face sx-question-mode-content-face) + (mapc #'sx-question-mode--print-comment .comments)))))) + +(defun sx-question-mode--fill-string (text) + "Fill TEXT according to `markdown-mode' and return it." + (with-temp-buffer + (insert text) + (markdown-mode) + (goto-char (point-min)) + ;; ;; Do something here + ;; (while (null (eobp)) + ;; (skip-chars-forward "\r\n[:blank:]") + ;; (markdown-pre-region)) + (buffer-string))) (defun sx-question-mode--propertized-display-name (author) "Return display_name of AUTHOR with `sx-question-mode-author' face." |