Comments (21)
Thanks a lot! However the problem with this is that although vscode is built on electron (and so nodejs) node isn't actually installed "system-wide" when you just install vscode (I think? I'm not super knowledgeable about how electron and nodejs work). Regardless, running exec('node')
won't work on a clean install of vscode+betterfountain.
Unfortunately I think the only option to get this working "out of the box" is completely integrating afterwriting into betterfountain :/
from betterfountain.
Work on integrating afterwriting is being done on the feature/afterwriting branch.
from betterfountain.
So I've successfully ported the pdf export functionality from afterwriting right into this extension in the feature/newparser
branch. The only problem left to figure out is error handling when exporting the PDF.
from betterfountain.
This is the relevant line.
The export to PDF function relies on an npm package called afterwriting. It's marked as a dependency in the extension's package.json, so normally it should get installed with the extension.
I'm pretty new to node.js and typescript, so I'm gonna assume i'm doing something really stupid. Any help is indeed welcome :)
from betterfountain.
I'll start looking into it. Are you able to export your .fountain files to PDF?
from betterfountain.
Worked when I ran npm install -g afterwriting
.
I wonder why it didn't work "out of the box." I'll close this one since I'm set, but I'll see if I can't duplicate the issue on another computer tomorrow.
from betterfountain.
Ok so it turns out this issue isn't fixed, i'm going to try and directly integrate the required tools from afterwriting into the extension, to avoid all of this somewhat hacky cli stuff.
from betterfountain.
npm install
is not run for a vscode extension: microsoft/vscode#23300 (comment)
But if you vsce
pack it after running npm install
, it should be included (unless specifically excluded in .vscodeignore
)
Instead of using a globally pathed afterwriting
, in your activation handler (where you call the afterwriting
cli) get the absolute path to your bundled ./node_modules/afterwriting/awc.js
and substitute your call to afterwriting
with that.
Before (pseudocode):
exec(`afterwriting --source <other_options_here>...`)
After (pseudocode):
let afterwritingPath = context.asAbsolutePath(path.join('node_modules', 'afterwriting', 'awc.js'))
exec(`node ${afterwritingPath} --source <other_options_here>...` )
I haven't had a chance to test it yet and/or send a PR...
from betterfountain.
Found your next sprint, @piersdeseilligny. ^^lol
from betterfountain.
@piersdeseilligny You're right about node. Perusing the afterwriting
code, it seems simple (famous last words! haha) since the code is basically in https://github.com/ifrost/afterwriting-labs/blob/master/js/client/client-controller.js
from betterfountain.
@shazron yup, simple until you run into protoplast
everywhere, which is a custom library written by the dev of afterwriting with zero documentation :/
from betterfountain.
Thanks for this work! Much appreciated
from betterfountain.
I sent an email about afterwriting to Piotr Jamróz (the author), and basically the only way to correctly integrate afterwriting into betterfountain is to completely extract the logic to a separate library.
Therefore, the plan is to make fountain-js (powering the live preview) as good as afterwriting at parsing fountain, and then use the tokens obtained for the live preview to create the pdf, reusing code from afterwriting.
Gonna remove the breaking changes from the feature/afterwriting
branch, merge the smaller ones to master, and simultaneously work on the pdf export in feature/pdf
and improve fountain-js in master
.
from betterfountain.
@piersdeseilligny thanks for this, makes sense. If you have architected this out and you need assistance writing some parts, let me know!
from betterfountain.
@shazron will do :) I'm still busy figuring out how exactly this is gonna work, but i'il let you know if I need help.
The current plan has changed since my last message: I'm going to replace the fountain-js parser with a port of the afterwriting one (just here), which is actually way better designed.
That requires slightly rewriting the way the html is obtained from the tokens, but it will be significantly easier to add the pdf export code from afterwriting once that's done. Also, consistency between the live preview and the rendered pdf is kind of a good thing.
from betterfountain.
Do you have a Patreon or something? I'd love to throw you $1/month for this.
from betterfountain.
@Quinncuatro Thanks a lot! I don't have a Patreon, but I just added a "Support via PayPal" button to README.md
from betterfountain.
@piersdeseilligny What kind of percentage is PayPal taking?
from betterfountain.
@Quinncuatro It depends on where you are, any currency conversion involved, and if you're paying by debit/credit or via a paypal balance/linked bank account. From what I can tell, it can be anywhere between 0% and 4%, which is still less than the 5% that Patreon takes.
from betterfountain.
@piersdeseilligny - https://github.com/sponsors
from betterfountain.
@Quinncuatro I know this is almost a year-old thread, but thanks for letting me know about that! My Github sponsors profile has been accepted, so it's now an option for anyone wishing to support this project.
from betterfountain.
Related Issues (20)
- carriage return in notes not working HOT 1
- carriage return in notes not working HOT 2
- Feature request: Smart quotes HOT 1
- Use custom scopes for syntax highlighting HOT 1
- Set the default value for fountainconfig.scenes_numbers to both. HOT 1
- Support for non-latin character languages such as Chinese, Hebrew or Arabic HOT 3
- Jump to line returns "Illegal value for 'line'" HOT 1
- Feature Request: PDF Formatting Using Layout Language (maybe FDXT?) HOT 1
- Web Client seems to have some issues HOT 2
- Installing on mac
- Feature Request: Page Breaks in Live Preview HOT 8
- versionIndicator Scrolls on character page
- Live Preview to load only 1000 lines at a time
- Extension causes high cpu load HOT 1
- Spaces are rendered on line break
- Word count should ignore boneyard HOT 1
- PDF exports not working with right to left languages
- Q: How to change syntax colors ? HOT 2
- PDF Export errors, log doesn't show what's wrong on my end HOT 2
- Custom scene heading prefix in addition to int/ext/est HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from betterfountain.