benwr / ankdown

Easily make Anki flash cards in markdown
MIT License
134 stars 38 forks source link

Feature Request: Github flavored markdown #25

Open jay-pee opened 5 years ago

jay-pee commented 5 years ago

I made a test deck to look if ankdown is converting everything properly. After fixing the error in issue #24 and #7 it did work! :)

Actually not fully :P

My last card is about github flavored markdown:

# Github Flavored

%

**Syntax Higlighting**

```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}

Task List

Tables

test test2 test3 test4 test5
test test2 test3 test4 test5
test test2 test3 test4 test5
test test2 test3 test4 test5

Strike through

this



Ankdown doesn't support this fully. Her is a picture of the rendered version:

![Capture](https://user-images.githubusercontent.com/9380980/60755030-6f4d2080-9fea-11e9-9098-c81fedeb7bbf.PNG)

Would be nice to have this feature :)
jay-pee commented 5 years ago

If you are interested in the full test deck here it is:

# Headings

%

# Heading level 1   
## Heading level 2  
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6

---

# Paragraphs

%

I really like using Markdown.

I think I'll use it to format all of my documents from now on. 

---

Line Breaks

%

This is the first line.  
And this is the second line. 

---

# Emphasis

%

I just love **bold text**.
Italicized text is the *cat's meow*.
This text is ***really important***.

---

# Blockquotes

%

> Dorothy followed her through many of the beautiful rooms in her castle.

> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
>  *Everything* is going according to **plan**.

---

# Lists

1. First item
2. Second item
3. Third item
4. Fourth item 

1. First item
2. Second item
3. Third item
    1. Indented item
    2. Indented item
4. Fourth item 

- First item
- Second item
- Third item
- Fourth item 

- First item
- Second item
- Third item
    - Indented item
    - Indented item
- Fourth item 

*   This is the first list item.
*   Here's the second list item.

    I need to add another paragraph below the second list item.

*   And here's the third list item.

1.  Open the file.
2.  Find the following code block on line 21:

        <html>
          <head>
            <title>Test</title>
          </head>

3.  Update the title to match the name of your website.

---

# Code

%

At the command prompt, type `nano`.

``Use `code` in your Markdown file.``

    <html>
      <head>
      </head>
    </html>

---

# Horizontal Rules

%

***

_________________

---

# Links

%

My favorite search engine is [Duck Duck Go](https://duckduckgo.com).

My favorite search engine is [Duck Duck Go](https://duckduckgo.com "The best search engine for privacy").

<https://www.markdownguide.org>
<fake@example.com>

I love supporting the **[EFF](https://eff.org)**.
This is the *[Markdown Guide](https://www.markdownguide.org)*.

---

# Images

%

![Philadelphia's Magic Gardens. This place was so cool!](philly-magic-garden.jpg "Philadelphia's Magic Gardens")

[![An old rock in the desert](shiprock.jpg "Shiprock, New Mexico by Beau Rogers")](https://www.flickr.com/photos/beaurogers/31833779864/in/photolist-Qv3rFw-34mt9F-a9Cmfy-5Ha3Zi-9msKdv-o3hgjr-hWpUte-4WMsJ1-KUQ8N-deshUb-vssBD-6CQci6-8AFCiD-zsJWT-nNfsgB-dPDwZJ-bn9JGn-5HtSXY-6CUhAL-a4UTXB-ugPum-KUPSo-fBLNm-6CUmpy-4WMsc9-8a7D3T-83KJev-6CQ2bK-nNusHJ-a78rQH-nw3NvT-7aq2qf-8wwBso-3nNceh-ugSKP-4mh4kh-bbeeqH-a7biME-q3PtTf-brFpgb-cg38zw-bXMZc-nJPELD-f58Lmo-bXMYG-bz8AAi-bxNtNT-bXMYi-bXMY6-bXMYv)

---

# Escaping 

%

\* Without the backslash, this would be a bullet in an unordered list.

---

# Diacritic

%

Akut (wie in é)  
Breve (Brevis, Halbkreis, wie in ă; runde Form)  
Breve darunter (wie in ḫ)  
Cédille (Zedille, Cedilla [span.: „kleines z“], wie in ç)  
übergesetzte Cédille (übergesetztes Komma, der Form nach wie ein übergesetztes einfaches schließendes deutsches Anführungszeichen, im Lettischen eine allografische Variante der Cédille, wie in ģ)  
Doppelakut (wie in ő) und Doppelgravis (wie in ȁ)  
Gravis (wie in è)  
Haken (vietnamesisch: dấu hỏi, wie in ả, ủ, ỷ)  
Hatschek (Háček, Mäkkčeň, Caron, Häkchen, wie in č, ř, š, ž; spitze Form; im Tschechischen/Slowakischen bei Kleinbuchstaben mit Oberlänge allografisch wie Apostroph: ď, ť)  
Horn (wie in ơ)  
untergesetztes Komma (rumänisch, nicht identisch mit der Cédille: wie in ș, ț)  
Kroužek (Ring, Kringel, Kreisakzent, wie in tschechisch ů und dänisch/norwegisch/schwedisch å)  
Makron (Querstrich, Balken, Längestrich, kurzer Überstrich, wie in ā)
Unterstrich (Makron darunter wie in a)  
Mittelpunkt (wie in l·l)  
Ogonek (Nasalhaken, Krummhaken, wie in ę)  
Punkt darunter (wie in ḍ, ṭ)  
Punkt darüber (wie in ż)  
Schrägstrich (wie in ø, ł)  
Tilde (wie in ñ)  
Trema (Diärese­zeichen wie in ë; in Unicode auch Umlaut­zeichen wie in ä, ö, ü)  
Zirkumflex (wie in â, ê, î)  

---

# Emojis

%

😀 😁 😂 🤣 😃 😄 😅 😆 😉 😊 😋 😎 😍 😘 🥰 😗 😙 😚 ☺️ 🙂 🤗 🤩 🤔 🤨 😐 😑 😶 🙄 😏 😣 😥 😮 🤐 😯 😪 😫 😴 😌 😛 😜 😝 🤤 😒 😓 😔 😕 🙃 🤑 😲 ☹️ 🙁 😖 😞 😟 😤 😢 😭 😦 😧 😨 😩 🤯 😬 😰 😱 🥵 🥶 😳 🤪 😵 😡 😠 🤬 😷 🤒 🤕 🤢 🤮 🤧 😇 🤠 🤡 🥳 🥴 🥺 🤥 🤫 🤭 🧐 🤓 😈 👿 👹 👺 💀 👻 👽 🤖 💩 😺 😸 😹 😻 😼 😽 🙀 😿 😾 

---

# Chinese

%

老板 很 生气。  
你 家 也 很 远 吗?  
爸爸 很 忙,妈妈 也 很 忙  
他 和 他 弟弟 都 很 帅。 

---

# Latex

%

$-1=e^{j\pi}$

---

# Github Flavored

%

**Syntax Higlighting**

```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}

Task List

Tables

test test2 test3 test4 test5
test test2 test3 test4 test5
test test2 test3 test4 test5
test test2 test3 test4 test5

Strike through

this

benwr commented 5 years ago

Ooh, this is great! Thanks! When I've got some spare time I may add this to the repository as an integration test

jay-pee commented 5 years ago

Just recognize that the dollar sign in the javascript code block is substituted. :-/ so that is actually the reason why the syntax highlighting doesn't work.

jay-pee commented 5 years ago

Ankdown translates the markdown code with misaka to html. There is a extension flag for tables and strike through. You could write something like this:

    return misaka.html(field, extensions=("fenced-code", "math", "tables", "strikethrough"))

However I test this flags and it seems not to work for me. Didn't found a flag for task lists