@@ -199,6 +199,14 @@ public function shortcode( array $rawattr ) {
199
199
200
200
if ( is_feed () ) {
201
201
$ html = sprintf ( '<a href="%s" target="_blank"><em>%s</em></a> ' , esc_url ( $ url ), __ ( 'View this code snippet on GitHub. ' , 'gistpress ' ) );
202
+
203
+ /**
204
+ * Filter what is shown in feeds.
205
+ *
206
+ * @since 2.0.0
207
+ *
208
+ * @param string $html Markup to show in feeds.
209
+ */
202
210
return apply_filters ( 'gistpress_feed_html ' , $ html );
203
211
}
204
212
@@ -214,6 +222,16 @@ public function shortcode( array $rawattr ) {
214
222
wp_enqueue_style ( 'gistpress ' );
215
223
}
216
224
225
+ /**
226
+ * Filter the output HTML.
227
+ *
228
+ * @since 2.0.0
229
+ *
230
+ * @param string $html The output HTML.
231
+ * @param string $url The URL to the Gist.
232
+ * @param array $attr Shortcode attributes, standardized.
233
+ * @param int $id Post ID.
234
+ */
217
235
$ html = apply_filters ( 'gistpress_html ' , $ html , $ url , $ attr , get_the_ID () );
218
236
219
237
foreach ( $ attr as $ key => $ value ) {
@@ -485,6 +503,13 @@ public function process_gist_html( $html, array $args ) {
485
503
}
486
504
}
487
505
506
+ /**
507
+ * Filter the classes applied to a line of the Gist.
508
+ *
509
+ * @since 2.0.0
510
+ *
511
+ * @param array $classes List of HTML class values.
512
+ */
488
513
$ classes = apply_filters ( 'gistpress_line_classes ' , $ classes );
489
514
$ class = ( ! empty ( $ classes ) && is_array ( $ classes ) ) ? ' class=" ' . implode ( ' ' , $ classes ) . '" ' : '' ;
490
515
@@ -611,12 +636,47 @@ protected function rebuild_shortcode( array $rawattr ) {
611
636
* @return array Standardized and sanitized shortcode attributes.
612
637
*/
613
638
protected function standardize_attributes ( array $ rawattr ) {
639
+ /**
640
+ * Filter the shortcode attributes defaults.
641
+ *
642
+ * @since 2.0.0
643
+ *
644
+ * @param array $gistpress_shortcode_defaults {
645
+ * Shortcode attributes defaults.
646
+ *
647
+ * @type bool $embed_stylesheet Filterable value to include style sheet or not.
648
+ * @type string $file File name within gist.
649
+ * @type array $highlight Lines to highlight.
650
+ * @type string $highlight_color Filterable hex color code.
651
+ * @type string $id Gist ID.
652
+ * @type int $lines Number of lines to show.
653
+ * @type int $lines_start Which line number to start from.
654
+ * @type bool $show_line_numbers Show line numbers or not, default true.
655
+ * @type bool $show_meta Show meta information or not, default true.
656
+ * }
657
+ */
614
658
$ defaults = apply_filters (
615
659
'gistpress_shortcode_defaults ' ,
616
660
array (
661
+
662
+ /**
663
+ * Filter to include the style sheet or not.
664
+ *
665
+ * @since 2.0.0
666
+ *
667
+ * @param bool $gistpress_stylesheet_default Default is true.
668
+ */
617
669
'embed_stylesheet ' => apply_filters ( 'gistpress_stylesheet_default ' , true ),
618
670
'file ' => '' ,
619
671
'highlight ' => array (),
672
+
673
+ /**
674
+ * Filter to set highlight color.
675
+ *
676
+ * @since 2.0.0
677
+ *
678
+ * @param string $gistpress_highlight_color Hex color code, default is `#ffc`.
679
+ */
620
680
'highlight_color ' => apply_filters ( 'gistpress_highlight_color ' , '#ffc ' ),
621
681
'id ' => '' ,
622
682
'lines ' => '' ,
0 commit comments