docs: update styling.md on how to display code snippets#461
docs: update styling.md on how to display code snippets#461leedoughty wants to merge 3 commits intoankitects:mainfrom
Conversation
GithubAnon0000
left a comment
There was a problem hiding this comment.
Aside from the things I mentioned in the comments:
In the future we could add a section about making syntax highlighting work. E.g. I use highlight.js in my cards and it works flawlessly on AnkiDroid and Anki (other clients untested, but they should work fine as well) and doesn't need an addon or platform specific APIs.
src/templates/styling.md
Outdated
| - On Windows, press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> | ||
| - On a Mac, press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> | ||
|
|
||
| **Inline code**\ |
There was a problem hiding this comment.
| **Inline code**\ | |
| ### Inline code |
Using a title also makes it linkable. I think this is prefered.
src/templates/styling.md
Outdated
| <code>console.log("Hello World!");</code> | ||
| ``` | ||
|
|
||
| **Code blocks**\ |
There was a problem hiding this comment.
| **Code blocks**\ | |
| ### Code blocks |
Using a title also makes it linkable. I think this is prefered.
src/templates/styling.md
Outdated
| If you want to include code in your Anki cards, you can use HTML tags to format text as code. To enter HTML mode: | ||
|
|
||
| - On Windows, press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> | ||
| - On a Mac, press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> |
There was a problem hiding this comment.
| If you want to include code in your Anki cards, you can use HTML tags to format text as code. To enter HTML mode: | |
| - On Windows, press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> | |
| - On a Mac, press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd> | |
| If you want to include code in your Anki cards, you can use HTML tags to format | |
| text as code. For that, you need to open the | |
| [HTML view](https://docs.ankiweb.net/editing.html#editing-features). |
(lines where broken as well to fit the 80 column limit)
I don't think we should include this at all. It should be a link to https://docs.ankiweb.net/editing.html#editing-features instead (though that section could use rewritting as well). You can add the keyboard shortcuts in the link I posted above at the right paragraph if you want to document them. It should also mention Linux in that case, like so:
- On Windows and Linux, press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>
- On a Mac, press <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>
There was a problem hiding this comment.
Thanks, that makes sense. I’ve updated the section based on your suggestions.
Regarding adding the shortcuts to the editing features section, it looks like there aren't many shortcuts documented there at the moment. Since Anki already shows the shortcut when you hover over a button, it might not be necessary to add them right now. Perhaps they could be included as part of a broader rewrite of that section later on.
This PR adds documentation on how to format code snippets in Anki cards. The new section covers keyboard shortcuts for entering HTML mode and provides examples for both inline code and code blocks. This will help users, especially those in IT/engineering fields, properly display code in their flashcards.
Closes #456