Git Product home page Git Product logo

html2karax's Introduction

html2karax

Converts static html to Karax single page application or server sider rendering.

Installation

nimble install html2karax

Usage

html2karax yourHtmlFile.html

yourHtmlFile.html

<figure role="img" aria-labelledby="cow-caption">
  <pre>
      ___________________________
  &lt; I'm an expert in my field. &gt;
      ---------------------------
          \   ^__^
           \  (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||
  </pre>
  <figcaption id="cow-caption">
    A cow saying, "I'm an expert in my field." The cow is illustrated using <em>preformatted</em> text characters.
  </figcaption>
</figure>

yourHtmlFile.nim

include karax / prelude

proc createDom(): VNode =
  result = buildHtml:
    figure(role = "img", aria-labelledby = "cow-caption"):
      pre:
        text """
      ___________________________
  < I'm an expert in my field. >
      ---------------------------
          \   ^__^
           \  (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||
"""
      figcaption(id = "cow-caption"):
        text "A cow saying, \"I'm an expert in my field.\" The cow is illustrated using "
        em:
          text "preformatted"
        text " text characters."

setRenderer createDom

html2karax's People

Contributors

planetis-m avatar gogolxdong avatar ringabout avatar

Stargazers

 avatar  avatar 이성철 avatar Ocat avatar Comamoca avatar Avahe Kellenberger avatar jg avatar muxueqz avatar Shishir Thakur avatar Masahiro Okubo avatar Terence Namusonge avatar rusty kay avatar Steve avatar Thomas T. Jarløv avatar  avatar  avatar join "eyes on Rafah" avatar  avatar Zoom avatar  avatar  avatar Levente avatar gecko avatar Artur Andrzejak avatar Juan Carlos avatar rak94 avatar  avatar  avatar

Watchers

James Cloos avatar wt avatar  avatar  avatar

Forkers

planetis-m dseeni

html2karax's Issues

Use a modified version of wordwrap

Apparently #15 is expected behavior (it's in the tests). We need a modified version that implements whitespace collapse. This way we can avoid deidenting and remove myRender. Will hopefully fix a few corner cases.

remove hack

let tmp = tmp.strip(trailing = false, chars = Newlines) # fix leading \n replaced by ' '

needs a proper fix.

[WONTFIX] html2karax inserts a root document tag

Actually the htmlparser does that. I have tried two ways to fix this already (seen on git history). The thing is, they were based on heuristics and may cause loosing data (in case there is a document tag), which more serious than some minor inconvenience. The user may have to manually format the output anyway.

Keep the order of attributes

Unfortunately xmltree uses strtabs internally, so we cant control it. Investigate if it could be ported to OrderedTable.

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.