Skip to content

Commit

Permalink
refactor(markdown): deprecate remarkAccordion.client (#247)
Browse files Browse the repository at this point in the history
* refactor(remark): deprecate remarkAccordion.client

* docs(sandbox): migrate guidelines from Org documents

* refactor(markdown): rename Remark -> Markdown

* feat(lint): enforce type-only imports when relevant

* refactor(markdown): remove unnecessary renderers

* chore(dependencies): bump dependencies
  • Loading branch information
angrybacon authored May 15, 2024
1 parent 453c8f0 commit 68ff996
Show file tree
Hide file tree
Showing 68 changed files with 751 additions and 977 deletions.
13 changes: 10 additions & 3 deletions CONTRIBUTING.org
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@ providing work for review.

** Contributing with Content

In a effort to avoid repeating myself and having to maintain things in multiple
places, the Markdown conventions guidelines will live next to the code. Visit
=/sandbox/markdown= anywhere the Wiki is hosted to access the guidelines.

See [[./CONTRIBUTING_WITH_MARKDOWN.org][CONTRIBUTING_WITH_MARKDOWN]].

** Contributing with Code

See [[./CONTRIBUTING_WITH_CODE.org][CONTRIBUTING_WITH_CODE]].
We're all consenting adults, use history as documentation and as long as you
respect the existing conventions and configured linting tools you can't go very
wrong.

** Testing your Changes

This is a Next.js application written with TypeScript. All you have to do in
This is a Next.js application written with TypeScript and I'll assume basic
knowledge for a JavaScript stack is known from the reader. All you have to do in
order to run the project locally is to clone the repository and install the
JavaScript dependencies.

Expand All @@ -36,4 +43,4 @@ project locally, Vercel generates and updates URLs for every pull requests on
the repository.

As a general advice, avoid pushing for every little change you make as build
minutes are limited.
minutes are free but limited.
53 changes: 0 additions & 53 deletions CONTRIBUTING_WITH_CODE.org

This file was deleted.

189 changes: 0 additions & 189 deletions CONTRIBUTING_WITH_MARKDOWN.org
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,6 @@ content.
Static content within the Wiki comes from those partials, this avoids having
to maintain content within code.

** General Markdown Conventions

- Fill your paragraphs to 80 columns
- If your title makes the frontmatter data longer than 80 columns, think of a
better heading for your document. In addition to annoy users with
terminal-based clients, it also might not look as good in the homepage where
article cards are rendered with their corresponding title with limited space
- Heading levels start at 2 in order to account for the page title
- Don't use unicode quote characters eg. =‘’= and =“”=. They might not render
properly for everyone so ASCII quotes should be preferred
- A colon right in front of a word will be interpreted as a Markdown /directive/
so make sure you have a space right after =:= when it is used as punctuation
- A dot right after a number character ie. when you end your sentence with a
digit, renders as a numbered list item. To avoid this behavior, escape the dot
with a backslash: =Brainstorm is good, you might want all 4\.=
- Depending on one's Markdown client, a dot at the end of a link can be
considered part of said link eg. when you end your sentences with a link.
Avoid bare links, wrap them with angled brackets =<= and =>=

In addition, a linter will run on your committed changes to detect necessary
improvements. A command is provided to help you sanitize your content locally:
=pnpm lint:wiki=.

If you can, set up your editor of choice to run =prettier= on save when you edit
Wiki content. It'll do almost everything for you and make the linter happy
automatically.

** Scryfall

In some contexts, you can refer to card names within Markdown. To ease the
Expand All @@ -70,48 +43,6 @@ multiple printings of the same card.
Duress | STA | 92
#+END_SRC

** Frontmatter

*** Chapters

Chapter documents can take advantage of a front section called /frontmatter/ in
Markdown parlance. It should start with a triple-dash line and end with another
triple-dash line. Within that section, a body of YAML metadata can be provided.

- =banner= (mandatory) ::
Configure a banner for the chapter page. Scryfall syntax is supported.
- =title= (mandatory) ::
A string for your chapter title. Wrap it with quotes to allow special
characters within such as =:= and ='=.
- =authors= ::
Comma-separated list of authors that you want to credit for the chapter
page. Currently unused.
- =order= ::
A number to specify the order of your chapter under its collapsible group
within the sidebar. By default chapters are alpha-sorted using their slug ie.
their path.

*** Articles

Articles documents don't have an =order= property but support other fields. Use
other existing articles for inspiration.

- =banner= (mandatory) ::
Set a banner for the article to display in the homepage as well as at the top
of the article in its own dedicated page. Scryfall syntax is supported.
- =kind= (mandatory) ::
A kind symbol. Available values can be found in the keys at
[[./src/tools/markdown/constants/Kind.ts][Kind.ts]].
- =title= (mandatory) ::
The string used for your article page title. Note that this does not have any
effect on the URL for your article.
- =authors= ::
Comma-separated list of authors that you want to credit for the article.
- =tags= ::
An array of tag symbols. Available values can be found in the keys at
[[./src/tools/markdown/constants/Tag.ts][Tag.ts]]. Tags are used to dictate
which card abbreviations should be documented in the sidebar.

** Tables of Content

An automatic table of content can be inserted in Markdown documents with an
Expand Down Expand Up @@ -154,39 +85,6 @@ You can insert inline Scryfall links for cards using the following syntax:
This will render an inline link reading "Brainstorm" and pointing to
[[https://scryfall.com/search?q=!Brainstorm]].

*** Card Rows

Use this directive to render card images within your Markdown content.
[[#scryfall][Scryfall queries]] are supported in order to specify which set to
use.

By default rows of cards are rendered with the =CENTERED= variant but you can
specify the variant with the =variant= keyword.

*Centered* rows allocate 25% of the available width for each image. Beyond 4
cards, images start shrinking so that they all fit on one line.

#+BEGIN_SRC markdown
:::row{variant=CENTERED}
Lion's Eye Diamond | MIR
Edge of Autumn
Thassa's Oracle
:::
#+END_SRC

*Pile* rows are rendered using a unique style to make them stand out to the
reader. In addition, they use a fixed width of 20% for each image.

#+BEGIN_SRC markdown
:::row{variant=PILE}
Lion's Eye Diamond | MIR
Edge of Autumn
Ideas Unbound
Lotus Petal
Thassa's Oracle
:::
#+END_SRC

*** Decklists

You can add decklists within your Markdown content, they will be rendered as a
Expand Down Expand Up @@ -221,93 +119,6 @@ column for the sideboard. In doubt, follow existing conventions.

For more details about color symbols, see the [[#mana][Mana section]].

*** Media Embeds

Media embeds are also supported:

*SoundCloud* embeds. Use the following directive and provide the media path as
found in the address bar.

#+BEGIN_SRC markdown
::soundcloud{url=ddftwiki/a-history-of-doomsday}
#+END_SRC

*Twitter* embeds. Provide the ID found in a tweet URL. They can easily introduce
[[https://web.dev/cls/][CLS issues]] in pages where they are rendered /too
early/ ie. too high in the document: don't overuse them.

#+BEGIN_SRC markdown
::tweet{id=1574576125535129600}
#+END_SRC

*YouTube* embeds. Provide the ID typically found in the URL behind the =v=
parameter in the address bar.

#+BEGIN_SRC markdown
::youtube{id=3LLIFHv5kbo}
#+END_SRC

*** Accordions

Collapsible blocks can be stacked against one another or used alone. Provide a
title for the clickable element as well as content for it.

The content can be Markdown text directly, or even directives.

#+BEGIN_SRC markdown
Note the `:::` to delimit a *container* block.

:::accordion[Click to expand]
*Always* be **casting** :card[Doomsday].
:::
#+END_SRC

Or pulled from a partial:

#+BEGIN_SRC markdown
Note the `::` to mean a *leaf* block with no children.

::accordion[Click to expand]{path=path/to/partial/one/sans/extension}
::accordion[Click to expand]{path=path/to/partial/two/sans/extension}
#+END_SRC

Do not specify the extension for the partial, =.md= is always assumed.

*** Mana

You can inline mana symbols /almost/ everywhere.

#+BEGIN_SRC markdown
{W} {U} {B} {R} {G}
#+END_SRC

When used collectively, for instance to indicate the color identity of an
archetype, use the same order as found on the back of a /Magic: the Gathering/
card. This makes searching for guilds and clans much easier later on. As an
exception to this rule and when referring to Doomsday colors, start with blue
and black as it makes it easier for the eyes to parse quickly the differences
from one wedge to the next.

The syntax that was chosen for the implementation can be found
[[https://mana.andrewgioia.com/icons.html][here]]. Currently only the mana costs
are available but loyalty and other color indicators may come soon :tm:.

*** Spoilers

Transient spoilers are supported through the `spoiler` directive.

#+BEGIN_SRC markdown
Always be casting :spoiler[Doomsday].
#+END_SRC

But also support block-level children, and nesting.

#+BEGIN_SRC markdown
:::spoiler
Always be casting :spoiler[Doomsday].
:::
#+END_SRC

*** Spoils Calculator

Insert a /Spoils of the Vault/ widget to let the reader run success rate
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default [
plugins: { import: PluginImport },
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
Expand Down
4 changes: 4 additions & 0 deletions markdown/partials/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ _Wizard of the Coast_ or their respective artist for older sets. For cropped
arts where the artist line of a card is not visible, the artists are mentioned
in the accessible text.

Mana symbols are rendered using the _Mana_ icon font made available by [Andrew
Gioia][mana]. See their section about licensing for more details.

Phyrexian scripture and the corresponding unofficial font assets were provided
from the work of [Stas][stas].

Expand All @@ -30,6 +33,7 @@ adapted from one icon to another.
[code:repository]: https://github.com/angrybacon/doomsday-wiki
[icons:mdi]: https://pictogrammers.com/library/mdi/
[icons:simple-icons]: https://simpleicons.org
[mana]: https://mana.andrewgioia.com/
[scryfall:api]: https://scryfall.com/docs/api
[stas]: http://stas.tk/
[wiki:license]: https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
Expand Down
Loading

0 comments on commit 68ff996

Please sign in to comment.