Giter Site home page Giter Site logo

y-taka-23 / wasm-pandoc Goto Github PK

View Code? Open in Web Editor NEW
92.0 2.0 11.0 7.08 MB

Pandoc compiled into WebAssembly by Asterius. πŸ“š

Home Page: https://y-taka-23.github.io/wasm-pandoc/

License: BSD 3-Clause "New" or "Revised" License

Makefile 9.66% Haskell 15.41% HTML 25.62% JavaScript 44.47% CSS 4.83%
wasm haskell asterius webassembly

wasm-pandoc's Introduction

Pandoc in WebAssembly (Try It)

Pandoc

Serving Locally

git clone https://github.com/y-taka-23/wasm-pandoc.git
cd wasm-pandoc
make start

wasm-pandoc's People

Contributors

y-taka-23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wasm-pandoc's Issues

Filters (integrated and external)

Is it technically possible to compile it enabling citeproc (which is integrated)? And external filters (like pandoc-crossref)?

Impressive work, by the way.

npm package?

It’s amazing that someone compiled Pandoc to WebAssembly! Have you considered creating an npm package for it?

unknown package: asterius-prelude

➜  wasm-pandoc git:(main) βœ— cabal update 
Downloading the latest package list from hackage.haskell.org
Updated package list of hackage.haskell.org to the index-state 2022-03-13T09:59:08Z
➜  wasm-pandoc git:(main) βœ— cabal install
cabal: Could not resolve dependencies:
[__0] trying: wasm-pandoc-0.1.0.0 (user goal)
[__1] unknown package: asterius-prelude (dependency of wasm-pandoc)
[__1] fail (backjumping, conflict set: asterius-prelude, wasm-pandoc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: wasm-pandoc, asterius-prelude

no space left on device

replace 'docker run ' to 'podman run' in Makefile and type make start, get error 'no space left on device'.

  • podman version 3.4.4
  • macOS 12.2.1

console detail

wasm-pandoc git:(main) βœ— make start
podman run --rm -v /Users/xxx/code/test/wasm-pandoc:/workspace -w /workspace terrorjack/asterius \
                ahc-cabal install \
                        --builddir _build/ahc-cabal --installdir _build \
                        --install-method copy --overwrite-policy always
Resolving "terrorjack/asterius" using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf)
Trying to pull docker.io/terrorjack/asterius:latest...
Getting image source signatures
Copying blob sha256:972d552e121bdc57dc4153bf43e513f26bad0d29b128c4a8526decb212038747
Copying blob sha256:202e395991f57f0835b7d65ed999a31de118bbe18e4624d575597730800c95db
Copying blob sha256:840f69ab81c8b6eae57982901c6aa91041eb768ae2965d715f2dbc17bf888a92
Copying blob sha256:972d552e121bdc57dc4153bf43e513f26bad0d29b128c4a8526decb212038747
Error: writing blob: adding layer with blob "sha256:972d552e121bdc57dc4153bf43e513f26bad0d29b128c4a8526decb212038747": Error processing tar file(exit status 1): write /root/.asterius/.stack-work/install/x86_64-linux-tinfo6/3445437948fd86ce7ef120ae609b3b54e4a1ea68fb09256c10b6b2a6394fb17d/8.8.4/share/x86_64-linux-ghc-8.8.4/asterius-0.0.1/.boot/asterius_lib/lib/x86_64-linux-ghc-8.8.4/amazonka-cloudsearch-1.6.1-4tsRzvJUAIQCe8Gm7ym9wI/libHSamazonka-cloudsearch-1.6.1-4tsRzvJUAIQCe8Gm7ym9wI.a: no space left on device
make: *** [compile] Error 125

JavaScript heap out of memory

problem:

I try to convert docx to html and get errors from terminal, eg. 'JavaScript heap out of memory'.

btw, I convert T.Text to T.Text, like markdown to html, is successful,and I convert BSL.ByteString to T.Text is block by (reader def input)

devices and os:

  • MacOS: 12.2.1 (21D62)
  • docker: mac docker app v4.5.0 (74594)
  • nodejs: 16.13.1
  • browser: mac chrome v96.0.4664.110

code and detail:

example code: https://github.com/pasicopan/wasm-pandoc
detail:

// modify Main.hs
convertFromTo :: T.Text -> String -> BSL.ByteString -> Maybe T.Text
convertFromTo from to input =
    case runPure $ (getReader from) of
        Left err  -> error (show err)
        Right (ByteStringReader reader, es) -> case runPure $ reader def input of
            Left err  -> error (show err)
            Right doc -> case runPure $ (writerOf to) def doc of
                Left err     -> error (show err)
                Right output -> Just output

convert :: JSString -> JSString -> JSUint8Array -> JSString
convert from to =
      textToJSString
    . fromMaybe (T.pack "")
    . convertFromTo (textFromJSString from) (fromJSString to)
    . BSL.fromStrict
    . byteStringFromJSUint8Array

foreign export javascript "convert" convert :: JSString -> JSString -> JSUint8Array -> JSString

error from browser

index.js:1 PandocParseError "No entry on path: META-INF/container.xml"
CallStack (from HasCallStack):
  error, called at app/Main.hs:36:26 in main:Main
f @ index.js:1
await in f (async)
(anonymous) @ VM4305:1
index.js:1 Uncaught RangeError: Offset is outside the bounds of the DataView
    at DataView.getBigUint64 (<anonymous>)
    at st.i64Load (index.js:1)
    at yt.evacuateClosure (index.js:1)
    at yt.scavengeStackChunk (index.js:1)
    at yt.scavengeClosure (index.js:1)
    at yt.scavengeLoop (index.js:1)
    at yt.performGC (index.js:1)
    at ht.returnedFromTSO (index.js:1)
    at ht.tick (index.js:1)
    at index.js:1

error from nodejs 16

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x10837c815 node::Abort() (.cold.1) [/Users/xxx/.nvm/versions/node/v16.13.1/bin/node]
 2: 0x10707baa9 node::Abort() [/Users/xxx/.nvm/versions/node/v16.13.1/bin/node]
 3: 0x10707bc1f node::OnFatalError(char const*, char const*) [/Users/xxx/.nvm/versions/node/v16.13.1/bin/node]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.