Skip to content
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

Added article about syntax highlight with Pygments #51

Merged
merged 6 commits into from Jan 16, 2020

Conversation

Ze0nC
Copy link
Contributor

@Ze0nC Ze0nC commented Jan 15, 2020

Hi. Thank you for making Publish.
I have made a plugin for syntax highlighting using Pygments, and added a How-to article about using the plugin.
I hope it will help a little bit to the project.
Here is an example on my site built with Publish:
https://czj.pw/highlight
Cheers,
Zhijin

Copy link
Owner

@JohnSundell JohnSundell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @Ze0nC, and fantastic that you built a plugin for Pygments! I left a few comments inline, mainly I'd like this new document to be somewhat simplified, to make it easier for me to maintain. Let me know if you want any additional info.

It is a Pygments plugin for [Publish](https://github.com/johnsundell/publish) to highlight code.
[Pygments](https://pygments.org) is a syntax highlighting tool made in Python that supports many languages.

## Requirements
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than putting instructions inline here, I'd prefer for this and the following "How to" section to simply reference your plugin's README. Otherwise, I'll have to make sure to keep this up to date as you change your implementation and requirements, which'll most likely result in this becoming out of date. Take a look at the Splash plugin's "How to" guide for example. I think this file should only contain step number 4, that is, how to insert your plugin into a publishing pipeline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved the detailed guide to plugin's README.md and simplified the How-to ariticle.

```swift
import SwiftPygmentsPublishPlugin
...
try DeliciousRecipes().publish(using: [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more generic website name here, like MyWebsite, since DeliciousRecipes only makes sense within the context of the README.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I will change it.

@@ -11,5 +11,6 @@ Shorter articles focused on explaining how to get a given task done using Publis
- [Adding Swift syntax highlighting to Markdown code blocks](HowTo/adding-swift-syntax-highlighting.md)
- [Nesting items within folders](HowTo/nested-items.md)
- [Using a custom `DateFormatter`](HowTo/using-a-custom-date-formatter.md)
- [Add syntax highlighting with Pygments](HowTo/add-syntax-highlighting-with-pygments.md)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "Adding" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Change has been made.

@JohnSundell JohnSundell added the awaiting update Awaiting an update from the PR author label Jan 15, 2020
Details are moved to plugin's readme.md
@Ze0nC
Copy link
Contributor Author

Ze0nC commented Jan 16, 2020

I have made some change to the articles.
Please have a look if they are better now.
Cheers.

Copy link
Owner

@JohnSundell JohnSundell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Ze0nC, it looks great now. Just a few grammar fixes + suggestions. Let me know if you don't have time to fix these and I can fix them post-merge, and let me know if I can provide any additional context.

@@ -0,0 +1,21 @@
# How to add syntax highlighting with Pygments
[Splash](https://github.com/JohnSundell/Splash) and its [official plugin](https://github.com/JohnSundell/SplashPublishPlugin) are great tools for highlighting swift syntax in Publish.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"swift" -> "Swift"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"in Publish" -> "when using Publish"

# How to add syntax highlighting with Pygments
[Splash](https://github.com/JohnSundell/Splash) and its [official plugin](https://github.com/JohnSundell/SplashPublishPlugin) are great tools for highlighting swift syntax in Publish.

However, some people write not only in Swift, but also in many other languages. There comes the [SwiftPygmentsPublishPlugin](https://github.com/Ze0nC/SwiftPygmentsPublishPlugin) to help.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: "There comes the ... to help" -> "That's when ... can be really useful"


However, some people write not only in Swift, but also in many other languages. There comes the [SwiftPygmentsPublishPlugin](https://github.com/Ze0nC/SwiftPygmentsPublishPlugin) to help.

Please follow the plugin's [installation guide](https://github.com/Ze0nC/SwiftPygmentsPublishPlugin#installation) to install pygments and add it to your website's Swift package, and then add it to publishing pipeline:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"pygments" -> "Pygments"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"and add it" -> "and to add it"
"to publishing pipeline" -> "to your publishing pipeline"

])
```

Please refer to [usage guide](https://github.com/Ze0nC/SwiftPygmentsPublishPlugin#usage) to see how to specify syntax language and more.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"refer to [" -> "refer to the ["


Please refer to [usage guide](https://github.com/Ze0nC/SwiftPygmentsPublishPlugin#usage) to see how to specify syntax language and more.

Note that you will need to add css for `Pygments` to actually see the highlighted code.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"css" -> "CSS".

Also if you're going to use Pygments here (stylized as code) then I recommend stylizing all other mentions of Pygments similarly.

@Ze0nC
Copy link
Contributor Author

Ze0nC commented Jan 16, 2020

Hi. I have fixed the grammar and now looks much better.

Btw I made another plugin to make tags have different colors. I will share it later.

Copy link
Owner

@JohnSundell JohnSundell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks so much @Ze0nC! Looking forward to seeing more plugins 🎉

@JohnSundell JohnSundell merged commit f478595 into JohnSundell:master Jan 16, 2020
@JohnSundell JohnSundell removed the awaiting update Awaiting an update from the PR author label Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants