How to input/parse CHANGELOG.md in-app?

My goal is to have a version number that the user can click, which will pop up the changelog, which would be pulled directly from CHANGELOG.md. Is this doable? I’m not even sure where to start.

You can use an npm package for that: https://www.npmjs.com/package/marked

Load your file:

var file = require('fs').readFileSync('path/to/CHANGELOG.md');

Parse the Markdown Syntax into readable HTML:

var parsedMarkdown = require('marked')(file)

You can search through the whole string and output only the section you’re interested in (based on the version number that was clicked).

Does this help?

1 Like

I thought about that approach… which of course would have to be server-side. I could call a Meteor method upon the user clicking the version number, which would summon up the contents of the file and render them.

You basically have no other way.
The client doesn’t know about the files on your server, you could do an HTTP request, but that’s just overkill if you have Meteor.methods available…

1 Like

If your code lives in a GitHub repo you could use gitraw to get the content of CHANGELOG.MD and parse it with markedjs.

Or you could put your CHANGELOG.MD in the public folder so your code doesn’t have to be on GitHub (especially when the repo is private)