Coder Social home page Coder Social logo

Markdown support feature about scalar HOT 2 OPEN

anvc avatar anvc commented on July 22, 2024
Markdown support feature

from scalar.

Comments (2)

scottkleinman avatar scottkleinman commented on July 22, 2024 2

Here's one makeshift solution to grab some Markdown from GitHub. Place the following code in the source of your page:

<script src="https://cdn.jsdelivr.net/remarkable/1.7.1/remarkable.min.js"></script>
<div id="github-content" style="display:none;"></div>

Then add to the pages Javascript options (adding the URL of the raw Markdown document on GitHub):

$(document).ready(function(){
    $("#github-content").load("URL_OF_MARKDOWN.md", function(markdown){
      var md = new Remarkable('commonmark');
      var html = md.render(markdown);
      $("#github-content").html(html).show();
    });
  });

The Scalar user guide warns that $(document).ready() may not work, but it does in this case. Grabbing Markdown content from GitHub allows you to edit offline and get excellent version control. The downside is that your content may not be wrapped in Scalar's proprietary markup, which may be needed for some Scalar functionality (plus, it adds a couple of extra http requests). I haven't tested yet whether the imported content will be retrievable using Scalar's API, for instance.

I think these are the sort of issues that would have to be addressed to add Markdown support. Perhaps CKEditor's Markdown plugin could be enabled to allow Markdown editing online. But I'm not sure what would be required to add specific Scalar functionalities. Still, I hope this is a start.

from scalar.

craigdietrich avatar craigdietrich commented on July 22, 2024

@baram204 Thanks for your note and kind words!

There's a number of markdown to HTML converters online, e.g., https://www.browserling.com/tools/markdown-to-html

Did you have something in mind as to what a built-in markdown converter might do?

from scalar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.