Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
31d06a4
update pandoc repo
johanneswilm Feb 10, 2025
75fbbed
Update links
johanneswilm Feb 10, 2025
c92ad77
Update README.md
johanneswilm Feb 10, 2025
3259e24
use patch for build
johanneswilm Feb 11, 2025
41623ec
Merge branch 'master' of github.com:johanneswilm/pandoc-wasm
johanneswilm Feb 11, 2025
9d68a29
clarify readme wording
johanneswilm Feb 11, 2025
9f59d23
Upload releases to ga run when not tagged
johanneswilm Feb 11, 2025
15afec9
actions/upload-artifact@v4
johanneswilm Feb 11, 2025
4d9de2e
fix filename
johanneswilm Feb 11, 2025
25ad35c
change reference to VERSION
johanneswilm Feb 11, 2025
e1317d4
use env.VERSION
johanneswilm Feb 11, 2025
94f0e68
use tagged pandoc version
johanneswilm Feb 11, 2025
a92165e
reorganize github actions
johanneswilm Feb 11, 2025
4d78291
switch github events release type
johanneswilm Feb 11, 2025
d99cc8b
github action events change
johanneswilm Feb 11, 2025
5245d39
0.2+3.6.3
johanneswilm Feb 11, 2025
dd1429e
Add package.json
johanneswilm Feb 11, 2025
59f7aeb
fix package.json syntax
johanneswilm Feb 11, 2025
c59abb7
0.3+3.6.3
johanneswilm Feb 11, 2025
5632d85
reorganize zipping
johanneswilm Feb 11, 2025
d633022
Merge branch 'main' of github.com:johanneswilm/pandoc-wasm
johanneswilm Feb 11, 2025
23ce56a
Use semver (requirement by npm)
johanneswilm Feb 11, 2025
ac6efee
set up for distribution via npm
johanneswilm Feb 11, 2025
6cf1ed2
Add maintainership. make exports work, add example to readme.
johanneswilm Feb 13, 2025
055a9dc
lint
johanneswilm Feb 13, 2025
96ec06d
lint
johanneswilm Feb 13, 2025
e1f914d
release to releases branch (while waiting for npm access)
johanneswilm Feb 13, 2025
e4062a4
0.5.1
johanneswilm Feb 13, 2025
ecdf7cb
Add mediafile output
johanneswilm Feb 13, 2025
ecf8fa9
0.6.0
johanneswilm Feb 13, 2025
58f19c3
correct dependency
johanneswilm Feb 13, 2025
45fa144
0.6.1
johanneswilm Feb 13, 2025
b743e09
update URLs
johanneswilm Feb 27, 2025
fccda16
disable distribution via releases branch
johanneswilm Feb 27, 2025
0757b87
0.6.2
johanneswilm Feb 27, 2025
d729384
add readme and license files to npm
johanneswilm Feb 27, 2025
dc9eb6b
refactor github actions script
johanneswilm Feb 27, 2025
54ef47e
change dir for patching
johanneswilm Feb 27, 2025
4e6606c
add pandoc build caching
johanneswilm Feb 27, 2025
fcae9ce
fix cache key reference
johanneswilm Feb 27, 2025
b633593
add pre-commit
johanneswilm Feb 27, 2025
bf77d0b
add extra files
johanneswilm Feb 27, 2025
a42e4a3
difference reference to reference variables
johanneswilm Feb 27, 2025
ea06f47
variable refernece change
johanneswilm Feb 27, 2025
73cee5c
remove unused shellcheck checker
johanneswilm Feb 27, 2025
9b75df5
disambigious variable names
johanneswilm Feb 27, 2025
238ec75
fix cache extraction
johanneswilm Feb 27, 2025
f3e28b7
fix url
johanneswilm Feb 27, 2025
5e0b198
pre-commit==4.1.0
johanneswilm Feb 27, 2025
d2a5624
switch to pre-commit action
johanneswilm Feb 27, 2025
6d3a56e
style changes
johanneswilm Feb 27, 2025
82ff51a
lint: add quotes
johanneswilm Feb 27, 2025
9fe1336
always deploy pages
johanneswilm Feb 27, 2025
0331c8c
0.6.3
johanneswilm Feb 27, 2025
eb0ce81
output github ref name
johanneswilm Feb 27, 2025
bd5849e
0.6.4
johanneswilm Feb 27, 2025
d3fe83a
github pages not for tag
johanneswilm Feb 27, 2025
de5a283
different ref reference
johanneswilm Feb 27, 2025
5567650
reset tagging, giving up
johanneswilm Feb 27, 2025
b4f0480
publish on release - does not seem to work with tag
johanneswilm Feb 27, 2025
a866526
0.6.5
johanneswilm Feb 27, 2025
29f2328
Revert "publish on release - does not seem to work with tag"
johanneswilm Feb 27, 2025
7514486
test publishign with tags again
johanneswilm Feb 27, 2025
19aa032
0.6.6
johanneswilm Feb 27, 2025
4a41420
pandoc 3.6.4
johanneswilm Mar 24, 2025
f3aa330
0.7.0
johanneswilm Mar 24, 2025
59297a8
update patch
johanneswilm Mar 24, 2025
2935bcc
pin ghc-wasm-meta
johanneswilm Mar 25, 2025
65d5776
0.7.1
johanneswilm Mar 25, 2025
537b73e
add repo links
johanneswilm May 26, 2025
0c1b15b
pandoc 3.7.0.1
johanneswilm May 26, 2025
ba14fa3
depencdency update
johanneswilm May 26, 2025
af13710
0.8.0
johanneswilm May 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 75 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
name: build

on:
merge_group:
pull_request:
push:
branches:
- master
workflow_dispatch:
pull_request:
release:
types: [published]

name: Build, deploy and release

jobs:
build:
name: build

runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
contents: write
steps:

- name: setup-alex-happy
run: |
pushd "$(mktemp -d)"
Expand All @@ -35,16 +33,32 @@ jobs:
~/.ghc-wasm/add_to_github_path.sh
popd

- name: checkout
- name: Checkout Pandoc-wasm
uses: actions/checkout@v4

- name: checkout
- name: Extract versions from version.txt
id: extract-version
run: |
VERSION=$(jq -r .version package.json)
echo "Extracted version: $VERSION"
PANDOC_VERSION=$(cat pandoc-version.txt)
echo "Extracted Pandoc version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "PANDOC_VERSION=$PANDOC_VERSION" >> $GITHUB_ENV

- name: Checkout Pandoc
uses: actions/checkout@v4
with:
repository: haskell-wasm/pandoc
ref: wasm
repository: jgm/pandoc
ref: ${{ env.PANDOC_VERSION }}
path: pandoc

- name: Patch Pandoc sources
run: |
cd pandoc
patch -p1 < ../patch/pandoc.patch
cd ..

- name: gen-plan-json
run: |
pushd pandoc
Expand All @@ -70,18 +84,63 @@ jobs:
run: |
mkdir dist
wasm-opt --low-memory-unused --converge --gufa --flatten --rereloop -Oz $(find pandoc -type f -name pandoc.wasm) -o dist/pandoc.wasm
cp frontend/*.html frontend/*.js dist
cp src/*.js dist

- name: test
run: |
wasmtime run --dir $PWD::/ -- dist/pandoc.wasm pandoc/README.md -o pandoc/README.rst
head --lines=20 pandoc/README.rst

- name: upload-pages-artifact
- name: Prepare pages
run: |
cp dist/pandoc.wasm demo/

- name: Upload pages
uses: actions/upload-pages-artifact@v3
with:
path: dist
path: demo
retention-days: 90

- name: deploy-pages
uses: actions/deploy-pages@v4

- name: Upload as build artifact
uses: actions/upload-artifact@v4
with:
name: pandoc-wasm-${{ env.VERSION }}
path: dist

- name: Zip dist folder
if: ${{ github.event_name == 'release' }}
run: |
cd dist
zip -r ../pandoc-wasm-${{ env.VERSION }}.zip .
cd ..

- name: Upload to release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pandoc-wasm-${{ env.VERSION }}.zip
asset_name: pandoc-wasm-${{ env.VERSION }}.zip
tag: ${{ github.ref }}
overwrite: true

- name: "Install node"
if: ${{ github.event_name == 'release' }}
uses: actions/setup-node@v3
with:
node-version: "22"

- name: Add package.json
if: ${{ github.event_name == 'release' }}
run: |
cp package.json dist/

- name: Distribute via NPM
if: ${{ github.event_name == 'release' }}
uses: JS-DevTools/npm-publish@v3
with:
package: "dist"
token: ${{ secrets.NPM_TOKEN }}
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# `pandoc-wasm`

*Fork for private experimentation.*

[![Chat on Matrix](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#haskell-wasm:matrix.terrorjack.com)

The latest version of `pandoc` CLI compiled as a standalone
`wasm32-wasi` module that can be run by engines like `wasmtime` as
well as browsers.

## [Live demo](https://tweag.github.io/pandoc-wasm)
## [Live demo](https://johanneswilm.github.io/pandoc-wasm)

Stdin on the left, stdout on the right, command line arguments at the
bottom. No convert button, output is produced dynamically as input
changes.

You're also more than welcome to fetch the
[`pandoc.wasm`](https://tweag.github.io/pandoc-wasm/pandoc.wasm)
[`pandoc.wasm`](https://johanneswilm.github.io/pandoc-wasm/pandoc.wasm)
module and make your own customized app. `pandoc.wasm` is fully
`wasm32-wasi` compliant and doesn't make use of any JSFFI feature in
the ghc wasm backend.
Expand All @@ -27,7 +29,7 @@ need at least 9.10 since it's the earliest major version with (my
non-official) backports for ghc wasm backend's Template Haskell & ghci
support.

It's built using my
It's build-method is based on this
[fork](https://github.com/haskell-wasm/pandoc/tree/wasm) which is
based on latest `pandoc` release and patches dependencies, cabal
config as well as some module code to make things compilable to wasm:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/index.js → demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
File,
ConsoleStdout,
PreopenDirectory,
} from "https://cdn.jsdelivr.net/npm/@bjorn3/browser_wasi_shim@0.3.0/dist/index.js";
} from "https://cdn.jsdelivr.net/npm/@bjorn3/browser_wasi_shim@0.4.0/dist/index.js";

const args = ["pandoc.wasm", "+RTS", "-H64m", "-RTS"];
const env = [];
Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "pandoc-wasm",
"version": "0.4.0",
"description": "Pandoc transpiled as WASM to be used in browsers.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "github.com:johanneswilm/pandoc-wasm.git"
},
"keywords": [
"pandoc",
"wasm"
],
"author": "Terrorjack",
"license": "MIT",
"dependencies": {
"browser_wasi_shim": "^0.4.0"
}
}
1 change: 1 addition & 0 deletions pandoc-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.6.3
Loading