Pleco Markdown

jurgen85

榜眼
I spent way too long trying various possible syntax combinations, and beyond the normal markdown we know and love, this is what I figured out so far:

Code:
@@boxed text@@
@grammar label@
=specifying grammar label=
[generic cross-reference](pleco:e?tc=繁&sc=简&py=pin1yin1)
:::a secret?:::

I will note that those generic cross-references can do fine with any single one of those parameters, but the more of them you specify the better it matches. Lists start automatically at the first number in that particular list. Have you found anything else? In particular I don’t know how to properly tag examples as Chinese characters and pinyin, or maybe provide automatically switching trad/simp.

As close to a “real” entry I can get:

IMG_0651.jpeg


Code:
@@A@@ @noun@ 
1. **bold**; evaluation @@MW@@ [次 ci4](pleco:e?tc=次&sc=次&py=ci4)
1. unrelated
1. surprise ^^small caps 3456789^^ 3456789
> 拼音例子 
> pin1yin1 li4zi5 
> pinyin example

@@B@@ @verb@ =literary= 
95. test; evaluate
1. derail; *italic*
    1. truly
        1. the
        1. ***bold italic***
    1. nonsense
 
I'd like to get some clarity on examples markup as well. I'm able to use all of the other formatting options mentioned above, but just using regular blockquotes for example text:

Code:
> 拼音例子 
> pin1yin1 li4zi5 
> pinyin example

(a) doesn't format it as an example:

IMG_3156.JPEG


and, more crucially, (b) makes it show up in the browse / results list, breaking the flow of definitions:

IMG_3158.jpeg


(Content from the MoE Min Nan dictionary, manually retypeset for demonstration purposes.)
 

mikelove

皇帝
Staff member
Example sentences are actually embedded dictionary entries. We need to document this a lot more fully, and I definitely would not spend a lot of time building anything around this since it could still change in the finished release, but in our own dictionaries there's a separate 'entry' for each example (also independently searchable) and then dictionary entries link to them as block quoted Markdown embeds, like this:

> ![](pleco:blahblah)

the 'pleco:blahblah' bit being the thing that you copy from the bottom of a Card Info screen ("link (tap to copy)") or can insert with the 'link' button above the keyboard in the card editor.

You can also embed a word or example that isn't its own entry by making a Markdown code block:

``` class_id_of_your_example_card_type
class_id_of_a_field: text for that field
class_id_of_another_field: text for that field
```

(and, because we really went hard with this, these inline blocks are still searchable like dictionary entries, with wildcards / mixed characters and pronunciation / etc)

You would also want to create a separate field for Minnan readings, rather than putting them in the Mandarin field, but the amount of configuration required to make that searchable + supported everywhere is pretty substantial, and we might not have it streamlined enough to be a viable option for end-users until a future 4.x release. The best that's likely doable with the current app would be to distribute a user dictionary file along with a .json export file containing Minnan search types / presentations / flashcard test types / etc and then require users to manually reconfigure a dozen or so things to make use of those new imported objects.
 
in our own dictionaries there's a separate 'entry' for each example (also independently searchable) and then dictionary entries link to them as block quoted Markdown embeds, like this:

> ![](pleco:blahblah)

the 'pleco:blahblah' bit being the thing that you copy from the bottom of a Card Info screen ("link (tap to copy)") or can insert with the 'link' button above the keyboard in the card editor.

You can also embed a word or example that isn't its own entry by making a Markdown code block:

``` class_id_of_your_example_card_type
class_id_of_a_field: text for that field
class_id_of_another_field: text for that field
```
Couldn't quite get the second one to work, I probably just need to mess with class names to get it right. First one works, but the downside is the entry list on my dictionary gets cluttered with examples. Embedding looks and works great, though, and now my entries look ~professional~, so I'm very happy about that:

IMG_3164.JPEG


---

Other markup items (both Pandoc and Pleco-specific):

IMG_3165.jpeg


Code:
1. ==underline==

2. ^superscript^ and ~subscript~ (useful for tones, distinguishing senses, maybe chemical formulas)

3. @@@boxed text small caps@@@ (distinct from @@BOXED TEXT@@)

4. ===small caps underline===

5. **bold**, ***bold italic***; ****black****, *****black italic*****

Only one I'm missing that I've seen in official dictionaries is the inverted boxed text which sometimes shows up in 現代漢語規範詞典:

IMG_3166.jpeg


but that's the only dictionary that seems to use it; others would just use =this= markup.
 

mikelove

皇帝
Staff member
"Black" and "black italic" are not intentional so I wouldn't necessarily bet on those continuing to work - I think in standard Markdown if you put four ****s in succession you get either "regular bold" or "nothing."

The inverted boxed text is a separate style class - not a Markdown character. If you define a 'text style' and attach a class ID to it, you can apply that class to a span as an attribute [like this]{.my_cool_class} to apply the style. I'm not sure whether we should add a few more reserved characters for things like this or not.
 
Top