-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to using Markdown code fence notation instead of shortcodes and update style guide accordingly. #45
Switch to using Markdown code fence notation instead of shortcodes and update style guide accordingly. #45
Conversation
Pages look better when viewed as Markdown and, more importantly, are imported into handbooks with better formatting retention. Also removes HTML entity substitutions as they are no longer necessary.
…e fences. * Removes 'Shortcodes' section as shortcodes are no longer recommended. Markdown code fences, as described in prior section, is the preferred method. * Escapes the code fence examples so the Markdown code fence notation themselves are shown. The examples intend to demonstrate the use of code fences (often with language hinting) but when unescaped this results in the code being formatted instead of shown. * Adds an 'HTML' example to the 'Fenced Code Blocks' section as that appears to have been an oversight. Fixes WordPress#44.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coffee2code Looks good. I left some inline remarks for you to consider.
It would be amazing if this finally solved the code sample display issue 🤞
Honest question: throughout the rest of the text, HTML is still used. Should/can the rest of the text now be converted to markdown too ? (as per the styleguide)
styleguide.md
Outdated
|
||
### Fenced Code Blocks | ||
|
||
#### Javascript | ||
```` | ||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual pages now use triple-backtick + javascript
, while here in the style guide it shows to use triple backtick + js
. Which is correct ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! This was the pre-existing recommendation that I neglected to update.
elements | ||
.addClass( 'foo' ) | ||
.children() | ||
.html( 'hello' ) | ||
.end() | ||
.appendTo( 'body' ); | ||
[/javascript] | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this fencing closer be at the start of the line ?
wordpress-coding-standards/css.md
Outdated
&042;/ | ||
```css | ||
/** | ||
* #.# Section title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines all need a space at the start (before the *
) I think, to align the stars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I think this is common, eg https://github.com/WordPress/twentytwenty/blob/6d0a5240af108d02f58ec797fd49b32458a4c698/style.css#L234-L240
@@ -530,19 +530,19 @@ var arr = _.chain( obj ) | |||
// Exit the chain | |||
.value(); | |||
|
|||
// arr === [ 'first comes thing 1', 'second comes thing 2', 'third comes lox' ][/javascript] | |||
// arr === [ 'first comes thing 1', 'second comes thing 2', 'third comes lox' ]``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this fencing closer be on a line by itself ?
wordpress-coding-standards/php.md
Outdated
[tab]$foo5 = 'somevalue4'; | ||
[/php] | ||
```php | ||
$foo = 'somevalue'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [tab]
markings were there on purpose to show tabs should be used not spaces.
$args = array( | ||
[tab]'post_type' => 'page', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dito.
wordpress-coding-standards/php.md
Outdated
[tab]case 'bar': | ||
[tab][tab]some_function(); | ||
[tab][tab]break; | ||
case 'foo': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dito.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @coffee2code, fingers crossed when this syncs 😏
@jrfnl Comments covered it all I can see, update and merge away 💯
* Correct styleguide to recommend 'javascript' as language hint for code fences (as used in all examples) * Restore `[tab]` as they are intended to be rendered as-is * Add space before multiline comment to align asterisks * Fix errant positioning of closing code fences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Merging this in now, will check how it all looks after sync shortly |
Checking various pages, the only issue I'm seeing as single quotes using
|
Style guide:
Fixes #44.