Welcome to the Airtable community!
You can run a script with an automation; however the entire script needs to fit in a single file. If you can find a minified version of the library that you can include in the script file, you might be able to use it.
Another option is to create a custom app that uses a library of your choice. Unlike scripts, custom apps can include libraries.
In order to create a new attachment using scripting, the file to be attached must exist at a publicly available url. However, if your goal is a markdown or html file, you can store the markdown or html in a long text field.