Tony Hayes
asked 8 years ago

Recently purchased DW Q&A Pro, was wondering if you had a reference for what Markdown formatting codes are supported?
As I’d like to have a list oif these to be able to show as a reference on editing pages (eg. as a toggling metabox.)
Do you have something like this? https://en.support.wordpress.com/markdown-quick-reference/

On a related note, the while markdown saves in comments and comment editing, when displayed the markdown is not processed for display… is there a way to fix this?

Thanks!

2 Answers
Kevin
answered 8 years ago

Hi Tony Hayes,

1. DW Q&A Markdown formatting support almost fully.
2. Please provide me username and password privately and I will fix it for you.

Regards,
Kevin.

Tony Hayes
replied 8 years ago

1. All the important ones do seem to be working fine… Except for the header formatting with hash # tags…

a. They don't seem to work/save properly if you do not fully encapsulate them.

ie. ### Header 3 does not work but ### Header 3 ### does. Both should work?

b. If you encapsulate them they do save and display fine, BUT on editing when they are converted back they are no longer encapsulated anymore and so saving the edit breaks them.

c. Similarly for editing, when converting back to Markdown, the H1 and H2 return a bunch of single or double underlines instead… perhaps this is the default way to do that Markdown? But it is not consistent with the rest of the header tags, it may be worth sticking with those?

I bought the Pro version for the main reason it supports the use of Markdown (for use on a WP coding forum – it suits way better than the Visual/Text WordPress way – it's a much better idea, awesome work bringing that about!) … but it would be *really* nice to have it in the documentation what works rather than all this experimenting.

Another important one that is not fully working is the syntax highlighting for code. Perhaps that is asking too much of Markdown by itself and WordPress does something addtional when it does it as in the link above, but from the styling I noticed the CodeMirror library is used as well, perhaps there is a simple way to use a filter from that library to recreate the syntax highlighting, if only just for the final public display?

 

Tony Hayes
answered 8 years ago

Upon a further look into the plugin filters, I’ve changed what I used to fix Markdown for comments…
I put this in a standalone file in my /wp-content/mu-plugins/
Basically the 3-4 filter lines for comments (similar to those that exist for questions/answers) could be added to the dwqa_inition_action_filter function for the next update instead to achieve the same result and all would be well. 🙂

add_action( 'wp_loaded', 'dwqa_custom_init_action_and_filter' );
function dwqa_custom_init_action_and_filter() {
 global $dwqa_options;
 if ( isset( $dwqa_options['markdown-editor'] ) && $dwqa_options['markdown-editor'] ) {
 // Comments
 add_filter('dwqa_pre_comment_content', 'dwqa_markdown_to_html', 1);
 add_filter('dwqa_pre_update_comment_content', 'dwqa_markdown_to_html', 1);
 add_filter('dwqa_comment_get_edit_content', 'dwqa_html_to_markdown', 1);
 // add_filter('dwqa_pre_comment_content', 'dwqa_new_paragraph');
 }
}

(not really sure if the new_paragraph filter is really needed here for comments, probably not?)

Powered by DW Question & Answer Pro