All Projects → gmarpons → asciidoc-hs

gmarpons / asciidoc-hs

Licence: BSD-3-Clause License
AsciiDoc parser that can be used as a Pandoc front-end, written in Haskell

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to asciidoc-hs

codewriting
Source for Codewriting (book) and the Codewriting/Code the Docs (site/blog)
Stars: ✭ 49 (+75%)
Mutual labels:  asciidoc, docs-as-code
pandoc alfred
Pandoc-Suite for Academic Writing in Markdown
Stars: ✭ 68 (+142.86%)
Mutual labels:  pandoc
QualtricsTools
Using R, Shiny, Pandoc, JSON, CSVs and more to automate processing Qualtrics surveys
Stars: ✭ 14 (-50%)
Mutual labels:  pandoc
vscode-terraform-doc-snippets
Snippets in vscode for all resources and data sources, as yanked directly from provider docs.
Stars: ✭ 26 (-7.14%)
Mutual labels:  docs-as-code
alldocs.app
Online text file converter
Stars: ✭ 164 (+485.71%)
Mutual labels:  pandoc
asciidoc-googledocs-addon
Export Google Docs as AsciiDoc
Stars: ✭ 55 (+96.43%)
Mutual labels:  asciidoc
docscii
DocBook to AsciiDoc converter
Stars: ✭ 14 (-50%)
Mutual labels:  asciidoc
pypandoc
Thin wrapper for "pandoc" (MIT)
Stars: ✭ 510 (+1721.43%)
Mutual labels:  pandoc
markdown-css
Stylesheets for Markdown to HTML conversion
Stars: ✭ 91 (+225%)
Mutual labels:  pandoc
slipbox
A static site generator for Zettelkasten notes
Stars: ✭ 32 (+14.29%)
Mutual labels:  pandoc
typeclassopedia-md
Markdown version of the Haskell Typeclassopedia
Stars: ✭ 33 (+17.86%)
Mutual labels:  pandoc
pandocker
🐳 A simple docker image for pandoc with filters, templates, fonts, and the latex bazaar
Stars: ✭ 118 (+321.43%)
Mutual labels:  pandoc
tufte-markdown
Use markdown to write your handouts and books in Tufte style.
Stars: ✭ 82 (+192.86%)
Mutual labels:  pandoc
wikitopdf
Export a repo's wiki as a PDF ebook.
Stars: ✭ 14 (-50%)
Mutual labels:  pandoc
bcs thesis
My bachelor's thesis on the Entity-Component-System pattern and ECST
Stars: ✭ 36 (+28.57%)
Mutual labels:  pandoc
pandoc-amsthm
provide a syntax to use amsthm environments in pandoc, with output in LaTeX and HTML
Stars: ✭ 19 (-32.14%)
Mutual labels:  pandoc
doctave
A batteries-included developer documentation site generator
Stars: ✭ 349 (+1146.43%)
Mutual labels:  docs-as-code
middleman-asciidoc
🔰 AsciiDoc support for Middleman 4. (In Middleman 3, AsciiDoc support is provided by a core extension).
Stars: ✭ 24 (-14.29%)
Mutual labels:  asciidoc
vim-minimd
A fast, folding Markdown outliner for Vim
Stars: ✭ 27 (-3.57%)
Mutual labels:  pandoc
emanote
Spiritual successor to neuron, based on Ema.
Stars: ✭ 301 (+975%)
Mutual labels:  pandoc

Asciidoc-hs

Warning
This project is in its early stages. Don’t expect to be able to use it in anything relevant, yet.

asciidoc-hs is a parser for the lightweight markup language AsciiDoc that can be used as a Pandoc front-end. It draws on commonmark-hs and is written in pure Haskell.

Build Status (GitHub Actions)

Mission

The main goal of this project is to become a reasonably complete implementation of the AsciiDoc language and to allow Pandoc to read AsciiDoc documents.

We want to read AsciiDoc as it’s used today (mainly in its Asciidoctor variant), and also support the AsciiDoc Standard when it arrives. We’re following the standardization process closely and we’ll try to contribute to it if we see the opportunity.

There have been former attempts at a Pandoc Reader for AsciiDoc, but they have been abandoned. If you want to feed Pandoc with an AsciiDoc source, your best option at the moment is probably to first convert to Docbook using Asciidoctor.

Secondary goals of the project are (but don’t expect any roadmap or timeline at the moment):

  • Be used as infrastructure for building advanced editor and IDE features (e.g., linters and live previewers). This means to be able to track precise source mapping information, among others.

  • Be scriptable in a similar way to Pandoc, but using and AST/DOM that is specific to AsciiDoc and fully supports its semantic richness.

  • Enable source-to-source transformations, including exact-print for those parts not explicitly modified by the scripts (a.k.a. lossless transformation).

  • End up being distributed together with Pandoc, as a regular Pandoc Reader.

Features

The supported features can be found in our compatibility matrix, currently based on Asciidoctor’s feature list.

Install

You’ll need to build from source for the time being. We expect to upload the package to Hackage soon.

If you don’t have Haskell installed in your system, try install GHC and Cabal with ghcup, and follow instructions for Cabal below.

asciidoc-hs has been tested with GHC 8.8 and 8.10, and Cabal 3.4.

Using Cabal

First, clone the repository:

$ git clone https://github.com/gmarpons/asciidoc-hs.git
$ cd asciidoc-hs

Then, build using cabal:

$ cabal build

You can optionally copy the resulting executable under a location of your choice (that should be under the PATH environment variable):

$ cp "$(cabal exec --verbose=0 --offline sh -- -c 'command -v asciidoc-hs')" ~/.local/bin/asciidoc-hs

Using Stack

First, clone the repository:

$ git clone https://github.com/gmarpons/asciidoc-hs.git
$ cd asciidoc-hs

Then, build using stack:

$ stack build

You can optionally copy the resulting executable under a location of your choice (that should be under the PATH environment variable):

$ cp "$(stack path --local-install-root)/bin/asciidoc-hs" ~/.local/bin/asciidoc-hs

Use

In the examples directory of this repository you can find some example AsciiDoc files and its various conversions.

The commands used to get the converted files are:

  • Convert to HTML using Asciidoctor:

    $ asciidoctor -a "sectids!" -a "showtitle" -a "linkcss" -a "stylesheet=https://cdn.jsdelivr.net/gh/asciidoctor/[email protected]/data/stylesheets/asciidoctor-default.css" -a "webfonts!" ⟨FILENAME⟩.adoc -o - > ⟨FILENAME⟩-asciidoctor.html
  • Convert to HTML using asciidoc-hs + Pandoc:

    $ cat ⟨FILENAME⟩.adoc | asciidoc-hs | pandoc -f json -t html5 --standalone --css="https://cdn.jsdelivr.net/gh/asciidoctor/[email protected]/data/stylesheets/asciidoctor-default.css" --css="./asciidoc-hs.css" > ⟨FILENAME⟩-pandoc.html
  • Convert to ODT using asciidoc-hs + Pandoc:

    $ cat ⟨FILENAME⟩.adoc | asciidoc-hs | pandoc -f json -t odt > ⟨FILENAME⟩-pandoc.odt
  • Convert to Markdown using asciidoc-hs + Pandoc:

    $ cat ⟨FILENAME⟩.adoc | asciidoc-hs | pandoc -f json -t markdown_strict > ⟨FILENAME⟩-pandoc.md

File asciidoctor-article-template.adoc presents a variety of AsciiDoc features. Those not yet supported by asciidoc-hs are commented out.

Contribute

Contributions are Welcome!

For any of:

  • reporting a bug,

  • filling a feature request,

  • opening a PR,

we’ll try to stick to the workflow and guidelines set in Kowainik contributing guidelines, with the difference that we use ormolu instead of stylish-haskell.

Implement a new AsciiDoc feature

AsciiDoc is an extensive language. There are plenty of features still to be implemented, with varying degrees of difficulty.

The recommended workflow is the following:

  1. Check the compatibility matrix to look for unsupported features.

  2. Fill an issue with the proposed feature if you cannot find it in the issue tracker, yet.

  3. Go inspect files Inlines.hs or Blocks.hs and see:

    • If the current AST data types (mainly Inline and Block) support the intended feature, or need to be modified.

    • Look for a similar and already implemented feature, and see how the corresponding parser functions are written.

  4. Discuss a possible implementation in the issue tracker.

  5. Modify the aforementioned files.

  6. Add new test cases for inlines or blocks.

  7. Add the necessary new cases to functions convertInline or convertBlock in Pandoc.hs.

You don’t need to wait to complete the steps above before opening a PR. In fact, it’s better if your code can be reviewed from the beginning.

Acknowledgements

This work has been supported by a Tweag Open Source Fellowship.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].