Giter Site home page Giter Site logo

Comments (5)

biggs avatar biggs commented on May 25, 2024 5

The usefulness of anki-editor lies in the easy way it exports sub- and super-scripts and prettifies entities, so I use an alternative which doesn't disable HTML but strips out the annoying <p> and </p> tags, adapted from the above post (thanks!). This seems to mostly do what I want, hopefully it will be useful for some others too:

(defun filter-out-p (str _ _)
  (replace-regexp-in-string "\n<p>\\|</p>\n\\|<p>\\|</p>" "" str))

(setq anki-editor--ox-anki-html-backend
  (org-export-create-backend
    :parent 'html
    :filters
      '((:filter-paragraph . filter-out-p))))

from anki-editor.

garrett-hopper avatar garrett-hopper commented on May 25, 2024

I was just looking for this exact thing; having the <p></p> wrappers doesn't work with many of my card templates which expect the text to be on a single line.

from anki-editor.

shouya avatar shouya commented on May 25, 2024

I have done that successfully by overriding anki-editor--ox-anki-html-backend with ascii backend, namely:

(setq anki-editor--ox-anki-html-backend 'ascii)

I agree it may be better to make this variable customizable.

from anki-editor.

benthamite avatar benthamite commented on May 25, 2024

@biggs This is a great fix. Unfortunately, it will cause org headings consisting of multiple paragraphs to be collapsed into a single paragraph in the exported card. My knowledge of Emacs Lisp is virtually nonexistent and I didn't figure out how to tweak the function to overcome this complication. Any help would be greatly appreciated.

from anki-editor.

benthamite avatar benthamite commented on May 25, 2024

In case it helps anyone, I solved the issue by removing biggs's elisp code snippet above and instead styling the appearance of the cards with the following css code (Tools > Manage note types > Cards > Styling):

p:first-of-type {
    margin: 0px;
}

So your notes will have the <p></p> wrappers, but this won't affect how the cards are displayed, except insofar as multi-paragraph cards will show correctly.

from anki-editor.

Related Issues (20)

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.