Picture of R Bax
suggested best practice for creating scorm package from markdown content
by R Bax - Thursday, 23 May 2019, 7:06 PM
 

I am using the authoring tool v0.8.1

Given the following scenario I'm wondering what everyone in this community thinks about my approach and if there may be a better way to accomplish what I'm after.

Background & problem: I have a lot of training material written in markdown format. I want to create SCORM packages out of this content and upload it to an LMS using adapt authoring.  I was hoping to upload the markdown files themselves directly into a component/extension/plugin that would properly translate them into html on the fly when displayed in the course, but as near as I can tell that doesn't exist.  I could do the manual work of copying the content into the built in components/extensions/plugins that are available in the authoring tool, but this is a lot of work for me and I can't help but to think there's a better way.  There are also other reasons for keeping the content itself in markdown format for other purposes.

The solution, possibly: I found a plugin named Responsive Iframe which displays html content.  The plugin won't take HTML directly - it takes a URL which feeds the html into the iframe it provides for display in the course it's embedded in.  So I then got the showdown javascript package running which dynamically converts my markdown content to html and displays that in a webpage.  I then use the url from this other website inside the adapt authoring responsive iframe plugin which displays the html inside my course for me.  

Even with this solution there are still challenges around the use of the iframe component where my height is going to be dynamic depending on which chapter of content is currently being displayed.  I think I can work around this with some fancy and as usual annoying css, however, this is just one more thing that leads me to believe that I'm making something that should be very simple, way too complex.  

Questions:

1. is what I'm doing really stupid?  Should I just suck it up and maintain two formats of my training material?  1 copy in markdown format, another in customized scorm packages?  
2. what's the recommended best way to solve this problem?
3. Is there a plugin out there that I don't know about that will actually take markdown as input, and convert that to html, thereby negating the crazy noted above?

Picture of Paul Hilton
Re: suggested best practice for creating scorm package from markdown content
by Paul Hilton - Thursday, 23 May 2019, 8:20 PM
 

There are extensions which convert other formats at run time. e.g. MathJax

e.g. https://github.com/cgkineo/adapt-mathJax

This works pretty well. I expect you could do the same sort of thing for mark down.

Maybe https://github.com/markedjs/marked for example.

Sounds interesting. Let me know how you get on.

 

Picture of Matt Leathes
Re: suggested best practice for creating scorm package from markdown content
by Matt Leathes - Friday, 24 May 2019, 9:32 AM
 

I'd be more tempted to create something that translated markdown into adapt JSON but without being able to see your content it's very hard to judge what the best way would be.

Otherwise it seems like you're just using Adapt as a kind of 'SCORM container' - which feels like a very heavy-handed way of doing what you need - or are you mixing this content in with other adapt content? If not and your aim is just to take some markdown, convert it to HTML and make it SCORM compliant there's surely easier ways of doing that.

Picture of R Bax
Re: suggested best practice for creating scorm package from markdown content
by R Bax - Friday, 24 May 2019, 1:33 PM
 

thank you both for the replies.  I do have a few videos, at least two 'hot graphics'  and a number of test questions per module that I had planned to use the Adapt authoring core plugins for.  I've been told I have to have everything in an LMS for a few different reasons, so wrapping the content in SCORM packages seemed logical, otherwise I feel I'm locking my company into our LMS and for a variety of reasons I want to try and avoid that.  Thanks again for the replies....I'll see what I can figure out...

Picture of Matt Leathes
Re: suggested best practice for creating scorm package from markdown content
by Matt Leathes - Friday, 24 May 2019, 2:27 PM
 
I do have a few videos, at least two 'hot graphics'  and a number of test questions per module that I had planned to use the Adapt authoring core plugins for

Ah OK I see makes sense now

Is using the Framework directly rather than the Authoring tool an option? Just thinking you could do something clever in the build process that converted markdown into JSON... Obviously depends enormously on how comfortable you are with coding that sort of thing. And whether it's possible to map the content you have in your markdown to Adapt components...

Picture of R Bax
Re: suggested best practice for creating scorm package from markdown content
by R Bax - Monday, 27 May 2019, 7:46 PM
 

yeah good idea - I think the content needs to go into the body section of a json file - I forget exactly which one but I found it earlier.  It's not impossible but it seems to me an error prone process; as we would need to put the content into that field according to both html and json formating...I might be able to link a library for markdown to html but then going to json is yet more work.  So far I've found using the 'source' feature of the text component and pasting in html there (converted outside of Adapt) works well enough.  It's far from automated but I think I can live with it.   Thanks again for all the replies...

Picture of R Bax
Re: suggested best practice for creating scorm package from markdown content
by R Bax - Thursday, 6 June 2019, 1:29 PM
 

ok so I wanted to circle back on this.  I have stitched together a few open source tools to accomplish this, documenting here in case others find it useful.  The majority of my training material is in markdown format.  I've got each markdown file setup to represent a different module of my training course, and the idea was that each of these will become their own scorm package for upload to our LMS.  Doing it this way allows me to have one source format and output to 2 (or more) different formats, which is necessary for me as I definitely see a time when either one of my company's customers or a member of my executive team asks me for a simple, single document that contains all my training material.  If I've got nothing but a bunch of custom scorm packages I can't easily do this, but if the source content is kept in markdown I can do both with _relative_ ease. 

So: the markdown files are converted to html via marked.  Marked is a javascript library that works within a web browser client or can be used via command line to output to stout.  json_encode() is then used to make the html json compliant.  json_encode is a php function.  As mentioned I have 1 markdown file per course, so the bash script, crude as it may be, is as follows:

#!/bin/sh

# quit if input isn't a directory
if [ ! -d "$1" ]
then
        echo 'input not a directory.  Input directory must contain 1 or more markdown files with an .md extension'
        exit 1
fi

for f in $1/*.md
do
        marked $f > $f.html
        json_encode.php $f.html > $f.html.json
done

exit 0
json_encode.php reads as follows:

#!/usr/bin/php
<?php

        $html = file_get_contents($argv[1]);

        print(json_encode($html));

?>

the resulting input.md.html.json file is manually copied into the body tag of the components.json file in the src/course/en folder of my course. 

My content contains images, and I've made this work by ensuring I reference them using relative paths to course/en/images.  non-relative paths will work in the "grunt server" preview using the Adapt framework, but _will not_ in my LMS - only the relative path works. 

So there it is....I hope this is useful to someone.  Scorm is great and all, but if all your content is only in that format...as near as I can tell you would be limited to having your training content in an LMS - you couldn't easily make a simple document out of the same content.  Maybe this is way overkill, maybe not...I'm honestly not sure, but at the very least, perhaps this info will be useful to someone...

 

Picture of Matt Leathes
Re: suggested best practice for creating scorm package from markdown content
by Matt Leathes - Thursday, 6 June 2019, 2:05 PM
 

Yes, SCORM is very much focussed on dealing with web content, in a browser, hosted on an LMS. Given that the SCORM standard was first developed in 2000/2001 it's often not that practical in the modern world - but it is still the most supported format!

You might like to take a look at xAPI if you need something a bit more flexible.