rasendubi / uniorg

An accurate Org-mode parser for JavaScript/TypeScript

Home Page:https://oleksii.shmalko.com/uniorg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`#+HTML`: and `#+BEGIN_EXPORT html` doesn't produce html output

wildwestrom opened this issue · comments

commented

Input:

#+HTML: <iframe width="560" height="315" src="https://www.youtube.com/embed/mYTfZeN65_s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Expected:

<iframe width="560" height="315" src="https://www.youtube.com/embed/mYTfZeN65_s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Actual:

&#x3C;iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/mYTfZeN65_s\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen>&#x3C;/iframe>

It seems like something has gone awry with the parser, though your previewer website shows the expected behavior.

How do you use uniorg?

#+HTML: and #+begin_export html produce raw nodes and you need rehype-raw after uniorg-rehype to convert raw nodes into proper HTML.

commented

I am definitely not using rehype-raw in my project. Imma try that and let you know if that fixes it.

I'm using your libraries through ClojureScript's JS interop, but that shouldn't be much of an issue.
https://github.com/wildwestrom/uniorg-util

commented
(ns uniorg-util.core
  (:require ["unified" :as unified]
            ["rehype-stringify" :as html]
            ["uniorg-parse" :as uniorg]
            ["uniorg-rehype" :as rehype]
            ["rehype-raw" :as raw]
            ["uniorg-extract-keywords" :refer (extractKeywords)]
            [lambdaisland.uri :as u :refer [uri]]
            [cljs-node-io.core :as io :refer [slurp spit]]
            [cljs-node-io.fs :as fs]
            [uniorg-util.helpers :as h]
            [uniorg-util.cli :as cli]))

(def ^:private processor
  (->
    (unified)
    (.use uniorg)
    (.use extractKeywords)
    (.use rehype)
    (.use raw)
    (.use html)))

Hell yeah! Works like a charm!