Comments (15)
Here's the package markdown-svgbob on pypi.
This library uses the "Solution 1" approach suggested by @tychota.
from svgbob.
FYI, in Foremark, I successfully took Solution 2 to render diagrams on web browsers (example). It works by compiling a facade crate (which is linked to Svgbob) into WebAssembly and hooking things up using wasm-bindgen
. The compiled module weighs roughly 200 kilobytes.
When the host application runs in a JavaScript environment, it seems like the most seamless, streamlined option because WebAssembly is architecture/platform-independent and doesnโt require IPC and subprocess management. It could be made into a single, standalone NPM package like they did with source-map
and I did with hyper3d-envmapgen
.
from svgbob.
Binaries are available here if anybody is brave enough to try:
https://gitlab.com/mbarkhau/markdown-svgbob/tree/master/src/markdown_svgbob/bin
from svgbob.
I'd like to do something similar and create an extension for Python Markdown, which would simply spawn svgbob in a subprocess.
I think the easiest thing to do would be to package the binaries together with the python distribution. If those were available to download for the various platforms then I could use those. Alternatively I might look into cross compilation.
In the meantime I'll just try and work with my local file ~/.cargo/bin/svgbob
.
from svgbob.
I took a short look at cross compiling, but I'm really new to the rust ecosystem and feel like I'm wasting my time. If there are any Rustaceans out there who already know how to produce static binaries for these targets, I would greatly appreciate some pointers.
x86_64-apple-darwin
x86_64-pc-windows-gnu
x86_64-unknown-linux-gnu
from svgbob.
@mbarkhau I'm not sure how are you installing svgbob. Right now, you can easily install svgbob using cargo. If you are using a linux machine, the x86_64-unknown-linux-gnu
target should not be a problem to compile to. I haven't done any cross compilation myself, but the simple way to do this is use a mac-osx to compile for x86_64-apple-darwin
and compiling for windows can also be easily done in windows machine. I didn't include the binary release for each of the platform, since I don't have access to all of these machines as well, aside from the extra step in maintenance.
from svgbob.
@ivanceras I did cargo install svgbob_cli
. Installing locally is not the problem, I'm just trying to find out where to get statically linked binaries for other platforms from, as I'm in a similar situation to you and only have access to a linux machine. I'd rather not impose on the users of a python library the requirement to have cargo installed on their machine.
from svgbob.
Apart from libc and possibly some other system libraries all executables created hy rustc don't link to any library. Because of this it is enough to copy executables to another machine to be able to run them. If you want to create a completely statically linked executable you can compile for x86_64-unknown-linux-musl
. After cargo install
you can find the executable in ~/.cargo/bin
.
from svgbob.
all executables created hy rustc don't link to any library. Because of this it is enough to copy executables to another machine to be able to run them.
That's good to know.
from svgbob.
I was able to cross compile for windows at least.
I initially ran cross build --verbose
which failed, but it seems that cross only invokes docker and I was able to modify the invocation so that the /svgbob
directory was added as a volume, not just the /svgbob_cli
.
$ cd svgbob/;
$ docker run --userns host \
--rm \
--user 1000:1000 \
-e CARGO_HOME=/cargo \
-e CARGO_TARGET_DIR=/target \
-e USER=$USER \
-e XARGO_HOME=/xargo \
-v $HOME/.xargo:/xargo \
-v $HOME/.cargo:/cargo \
-v $PWD/svgbob:/svgbob:ro \
-v $PWD/svgbob_cli:/svgbob_cli:ro \
-v $HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/rust:ro \
-v $PWD/svgbob_cli/target:/target \
-w /svgbob_cli \
-it japaric/x86_64-pc-windows-gnu:v0.1.14 \
sh -c 'PATH=$PATH:/rust/bin "cargo" "build" "--target" "x86_64-pc-windows-gnu" "--release" "--verbose"'
Output from wine
user@host:~/workspace/svgbob/svgbob_cli/target/x86_64-pc-windows-gnu/release (master)
$ ls
build deps examples incremental native svgbob.d svgbob.exe
user@host:~/workspace/svgbob/svgbob_cli/target/x86_64-pc-windows-gnu/release (master)
$ wine cmd.exe
Z:\home\user\workspace\svgbob\svgbob_cli\target\x86_64-pc-windows-gnu\release>svgbob.exe --help
svgbob 0.4.1
SvgBobRus is an ascii to svg converter
USAGE:
svgbob.exe [FLAGS] [OPTIONS] [input] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-s parse an inline string
-V, --version Prints version information
from svgbob.
I think I have a binary for x86_64-apple-darwin
based on this tutorial but I don't have any way to test it myself.
At least superficially it seems to be the right stuff
$ file src/markdown_svgbob/bin/svgbob_0.4.1_x86_64-Darwin
src/markdown_svgbob/bin/svgbob_0.4.1_x86_64-Darwin: Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE|HAS_TLV_DESCRIPTORS>
from svgbob.
I was able to start a MacOS VM and indeed the Darwin binary appears to work.
from svgbob.
@mbarkhau thanks for the binary releases you provide in your repo.
@ivanceras It would be great and highly appreciated, if you could provide statically linked release binaries for the common platforms (e.g. linux, windows, macos).
from svgbob.
Since this issue was opened, I think the situation with GitHub actions has become much better. I'm sure a PR would be welcome.
from svgbob.
https://github.com/agoose77/svgbob-wasm has make wasm api for javascript, It can be embedded in any web page.
from svgbob.
Related Issues (20)
- Styles are leaking HOT 2
- docs: radius 2.0 circle is iffy HOT 1
- Regressions in "Load Other Example"
- Choose a file extension for the new file format HOT 1
- Lines crossing issue HOT 3
- Online demo preview and SVG output don't match HOT 1
- Embed iosevka font in the svg image
- XML parsing errors on generated svg
- Scoping styles
- Maintain an official SVGBob WASM NPM package HOT 1
- Browsers' automatic dark mode theme generation breaks svgbob
- Comment in style section is not a CSS comment HOT 1
- Detection of O-Corner with two arrows fails
- Syntax for an arc HOT 2
- Triangle filling is not working HOT 3
- To easier the trial, add docker image
- "Basic Shapes" seems broken HOT 1
- Fails to parse quoting at end of line
- Question: create a bigger circles HOT 2
- Question: Change text color
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 svgbob.