3
$\begingroup$

Via

text = "Some string..";
CloudExport[text, "Text", Permissions -> "Public"]

we can upload raw strings to the Wolfram Cloud; however, it's not very rich when it comes to formatting.

Is it possible to upload text to Wolfram Cloud that is parsed (with syntax highlighting, bold, italics, quotes, etc) in formats like:

  • Markdown
  • Org-Mode
  • Shell/Bash code
  • ...

?

$\endgroup$

1 Answer 1

2
$\begingroup$

There's probably a JS library about anything you want so you need to find one and either pre parse the string (WebExectute?) or deploy a template page that will hold your original content and parse it later.

Here is a small example based on https://github.com/markedjs/marked

$mdHtmlTemplate = StringTemplate@"<!doctype html>
   <html>
   <head>
     <meta charset=\"utf-8\"/>
     <title>Marked in the browser</title>
   </head>
   <body>
     <div id=\"content\"></div>
     <script \
src=\"https://cdn.jsdelivr.net/npm/marked/marked.min.js\"></script>
     <script>
       document.getElementById('content').innerHTML = marked(``);
     </script>
   </body>
   </html>";


md = "'# Marked in the browser\\n\\nRendered by **marked**.'";


CloudDeploy[
  ExportForm[$mdHtmlTemplate @ md, "HTML"],
  "test/md1"
]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.