Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ok1kvk.cz
generator
Commits
e132da91
Verified
Commit
e132da91
authored
9 years ago
by
Isabella Skořepová
Browse files
Options
Downloads
Patches
Plain Diff
Allow lang selection for code highlighting
Metadata: lang="c" You can only select lang for whole article for now
parent
56c5e709
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sitegin/transformer-markdown.js
+11
-4
11 additions, 4 deletions
sitegin/transformer-markdown.js
with
11 additions
and
4 deletions
sitegin/transformer-markdown.js
+
11
−
4
View file @
e132da91
var
marked
=
require
(
'
marked
'
);
var
marked
=
require
(
'
marked
'
);
var
renderer
=
new
marked
.
Renderer
();
var
renderer
=
new
marked
.
Renderer
();
var
toURL
=
require
(
'
./transformer-urlizetags.js
'
).
toURL
;
var
toURL
=
require
(
'
./transformer-urlizetags.js
'
).
toURL
;
var
highlightjs
=
require
(
'
highlight.js
'
);
renderer
.
image
=
function
(
href
,
title
,
text
)
{
renderer
.
image
=
function
(
href
,
title
,
text
)
{
if
(
process
.
argv
[
3
]
!==
"
final
"
)
{
if
(
process
.
argv
[
3
]
!==
"
final
"
)
{
...
@@ -38,9 +39,6 @@ marked.setOptions({
...
@@ -38,9 +39,6 @@ marked.setOptions({
sanitize
:
false
,
sanitize
:
false
,
smartLists
:
true
,
smartLists
:
true
,
smartypants
:
false
,
smartypants
:
false
,
highlight
:
function
(
code
)
{
return
require
(
'
highlight.js
'
).
highlightAuto
(
code
).
value
;
}
});
});
module
.
exports
=
function
()
{
module
.
exports
=
function
()
{
...
@@ -48,7 +46,16 @@ module.exports = function() {
...
@@ -48,7 +46,16 @@ module.exports = function() {
tr
.
fancyname
=
"
transformer markdown
"
;
tr
.
fancyname
=
"
transformer markdown
"
;
tr
.
forEachPage
=
function
(
article
,
cb
)
{
tr
.
forEachPage
=
function
(
article
,
cb
)
{
article
.
origContent
=
article
.
content
;
article
.
origContent
=
article
.
content
;
article
.
content
=
marked
(
article
.
content
);
article
.
content
=
marked
(
article
.
content
,
{
highlight
:
function
(
code
)
{
var
h
;
if
(
highlightjs
.
getLanguage
(
article
.
metadata
.
lang
))
h
=
highlightjs
.
highlight
(
article
.
metadata
.
lang
,
code
,
true
);
else
h
=
highlightjs
.
highlightAuto
(
code
);
return
h
.
value
;
}
});
cb
();
cb
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment