NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Google Forms Markdown to HTML // @version 0.2.0 // @description renders description in markdown // @include https://docs.google.com/* // @license MIT // @copyright 2018, tomitrescak (https://openuserjs.org/users/tomitrescak) // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js // @require http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/marked/0.4.0/marked.min.js // ==/UserScript== function convert() { var markdown = $( this ).html(); $( this ).css({ whiteSpace: 'inherit'}); var newLinedMarkdown = markdown.replace(/(?:\r\n|\r|\n)/g, "\n\n"); newLinedMarkdown = newLinedMarkdown.replace(/\<(p|br)\>/g, "\n\n"); newLinedMarkdown = newLinedMarkdown.replace(/\<\/p\>/g, ""); var html = marked(newLinedMarkdown); $(this).html(html); } var converter = new Showdown.converter(); //lets find out if there is a README.md that we want to render $('.freebirdFormviewerViewHeaderDescription').each(convert); $('.freebirdFormviewerViewItemsSectionheaderDescriptionText').each(convert);