A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Python-Markdown/markdown/commit/10058fae6577e79b786f4e185218aebb1b53e937 below:

Refactor fenced_code & codehilite options (#816) · Python-Markdown/markdown@10058fa · GitHub

@@ -185,54 +185,67 @@ configuring extensions.

185 185 186 186

The following options are provided to configure the output:

187 187 188 -

* **`linenums`**:

189 -

Use line numbers. Possible values are `True` for yes, `False` for no and

190 -

`None` for auto. Defaults to `None`.

188 +

* **`linenums`**{ #linenums }:

189 +

An alias to Pygments' `linenos` formatter option. Possible values are `True` for yes, `False` for no and `None`

190 +

for auto. Defaults to `None`.

191 191 192 192

Using `True` will force every code block to have line numbers, even when

193 193

using colons (`:::`) for language identification.

194 194 195 195

Using `False` will turn off all line numbers, even when using shebangs

196 196

(`#!`) for language identification.

197 197 198 -

* **`guess_lang`**:

198 +

* **`guess_lang`**{ #guess_lang }:

199 199

Automatic language detection. Defaults to `True`.

200 200 201 201

Using `False` will prevent Pygments from guessing the language, and thus

202 202

highlighting blocks only when you explicitly set the language.

203 203 204 -

* **`css_class`**:

205 -

Set CSS class name for the wrapper `<div>` tag. Defaults to

204 +

* **`css_class`**{ #css_class }:

205 +

An alias to Pygments `cssclass` formatter option. Set CSS class name for the wrapper `<div>` tag. Defaults to

206 206

`codehilite`.

207 207 208 -

* **`pygments_style`**:

208 +

* **`pygments_style`**{ #pygments_style }:

209 209

Pygments HTML Formatter Style (`ColorScheme`). Defaults to `default`.

210 210 211 211

!!! Note

212 212

This is useful only when `noclasses` is set to `True`, otherwise the

213 213

CSS styles must be provided by the end user.

214 214 215 -

* **`noclasses`**:

215 +

* **`noclasses`**{ #noclasses }:

216 216

Use inline styles instead of CSS classes. Defaults to `False`.

217 217 218 -

* **`use_pygments`**:

218 +

* **`use_pygments`**{ #use_pygments }:

219 219

Specifies the use of Pygments in generating the output.

220 220 221 221

If `True` (the default) and Pygments is available, CodeHilite will use

222 222

Pygments to analyze and format the output. Additionally, if using Pygments

223 223

&gt;= 2.4, the output will be wrapped in `<code>` tags, whereas earlier

224 224

versions will not.

225 225 226 -

Otherwise, Pygments will not be used. If a language is defined for a code

227 -

block, it will be assigned to the `<code>` tag as a class in the manner

228 -

suggested by the [HTML5 spec][spec] (alternate output will not be

229 -

entertained) and may be used by a JavaScript library in the browser to

230 -

highlight the code block.

231 - 226 +

Otherwise, Pygments will not be used. If a language is defined for a code block, it will be assigned to the

227 +

`<code>` tag as a class in the manner suggested by the [HTML5 spec][spec] and may be used by a JavaScript library

228 +

in the browser to highlight the code block. See the [`lang_prefix`](#lang_prefix) option to customize the prefix.

229 + 230 +

* **`lang_prefix`**{ #lang_prefix }:

231 +

The prefix prepended to the language class assigned to the HTML `<code>` tag. Default: `language-`.

232 + 233 +

This option only applies when `use_pygments` is `False` as Pygments does not provide an option to include a

234 +

language prefix.

235 + 236 + 237 +

* Any other Pygments' options:

238 + 239 +

All other options are accepted and passed on to Pygments' lexer and formatter. Therefore,

240 +

valid options include any options which are accepted by the [html formatter] or

241 +

whichever [lexer] the code's language uses. Invalid options are ignored without error.

242 + 232 243

A trivial example:

233 244 234 245

```python

235 246

markdown.markdown(some_text, extensions=['codehilite'])

236 247

```

237 248 249 +

[html formatter]: https://pygments.org/docs/formatters/#HtmlFormatter

250 +

[lexer]: https://pygments.org/docs/lexers/

238 251

[spec]: https://www.w3.org/TR/html5/text-level-semantics.html#the-code-element


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4