Comments (20)
Since assemble.options can be passed into helpers now, a user should have the ability to set Marked.js options in the Gruntfile. My suggestion is that these options be namespaced in the options.marked
object:
assemble: {
options: {
marked: {
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
silent: false,
smartLists: true,
langPrefix: 'language',
}
}
}
I tried to implement this but even when I tried to hardcode the options in the {{markdown}}
and {{md}}
helpers whatever I do is overridden somewhere else. @doowb can you try to get this working properly?
from handlebars-helpers.
@jonschlinkert I'll take a look.
from handlebars-helpers.
ping @doowb
from handlebars-helpers.
from handlebars-helpers.
@doowb so these options are able to be set in the task options now? is this ready to be documented?
from handlebars-helpers.
btw, make sure you uninstall grunt-contrib-coffee and reinstall it. you're compiling with an order version.
from handlebars-helpers.
Did this fix make it into the 0.4.2 release?
from handlebars-helpers.
It should have, assemble always pulls down the latest from this repo. please let me know if you have any issue though
from handlebars-helpers.
Still wasn't able to accomplish the goal of changing the langPrefix via an option in my Gruntfile. Tried this...
assemble: {
options: {
marked: {
langPrefix: 'language-',
}
}
}
... but code blocks still have a class of 'lang-*' on them.
from handlebars-helpers.
@devert my bad... I moved the line to set the options to the correct place, but I forgot to specify that the marked
options are located in the marked
object.
@jonschlinkert I think we still need to bump the version and push to npm for the changes to make it to assemble.
from handlebars-helpers.
Updated to the lastest 0.4.3 release and I am still unable to configure the Marked.js options as it describes in the documentation. I applied the following marked options in my Gruntfile, but none of these options appear to have any affect on the compiled output.
assemble: {
options: {
marked: {
gfm: true,
highlight: function (lang, code) {
return hljs.highlightAuto(lang, code).value;
},
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: false,
smartypants: false,
langPrefix: 'language-'
}
}
}
from handlebars-helpers.
@devert sorry you're having issues with this still. It seems to be working for me. Out of curiosity, assuming that you are using that exact configuration, are you requiring hljs
somewhere? e.g.:
module.exports = function(grunt) {
var hljs = require('highlight.js');
// Project configuration.
grunt.initConfig({
// Templates
assemble: {
options: {
marked: {
gfm: true,
highlight: function (lang, code) {
return hljs.highlightAuto(lang, code).value;
},
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: false,
smartypants: false,
langPrefix: 'language-'
}
}
...
}
});
// Load npm and local plugins.
grunt.loadNpmTasks('assemble');
// Default task to be run.
grunt.registerTask('default', ['assemble']);
};
from handlebars-helpers.
@jonschlinkert Tried including requiring hljs
as you specified above. Did not seem to make a difference unfortunately. I also tried removing the highlight
option entirely. Still not working. I am using the latest node v0.10.15 and the latest grunt v0.4.1. For reference, here is my entire config options for assemble:
assemble: {
options: {
marked: {
langPrefix: 'language-'
}
},
build: {
options: {
flatten: true,
layoutdir: 'src/templates/layouts',
layout: 'default.hbs',
partials: ['src/templates/partials/*.hbs']
},
files: [
{ expand: true, cwd: 'src/templates/pages', src: ['*.hbs'], dest: '<%= proj.buildDir %>' },
]
}
}
I am including external markdown files using the {{{md}}}
helper.
from handlebars-helpers.
@jonschlinkert I created a quick project to test both the {{#markdown}}
and {{{md}}}
helpers separate from the project I am working on. Available here: https://github.com/devert/assemble-markdown-test
This is still not working for me even in this test project. Strangely, it doesn't even seem to compile the code blocks with highlight.js either. When built they look like...
<pre><code class="lang-javascript">function hello2 () {
console.log('oh hai again!');
};</code></pre>
... without any of the <span>
tags that provide syntax coloring.
As another note I am on Windows 7, not that it should necessarily make a difference.
from handlebars-helpers.
@devert have you checked to make sure the correct version of handlebars-helpers
is getting pulled in from npm?
Look in \node_modules\assemble\node_modules\assemble-handlebars\node_modules\handlebars-helpers\package.json
.
It should be v0.2.9. If it's not, I would do npm cache clear
and delete the node_modules folder and try npm i
again.
I know that path is a long one and we're working on cleaning it up so these modules are side-by-side dependencies instead of nested like this.
from handlebars-helpers.
@doowb Confirmed that handlebars-helpers
module is v0.2.9 already.
from handlebars-helpers.
Sorry @devert, I'm looking into this as well - and this evening I'll take a look at the project you linked to. I wanted this to be fixed myself, because I also customize the options. But it seems to be working for me. view the source for one of the code examples here: http://assemble.io/docs/options-collections.html. The classes appear to be how I defined them in the options (here: https://github.com/assemble/assemble-docs/blob/master/Gruntfile.js#L53). In fact, I still have all of the markdown options in the Gruntfile because I was testing them per this ticket.
just in case, did you try installing highlight.js directly in node_modules, rather than depending on the nested one that the helpers depend on?
(@doowb this is another good use case for having a defaults.yml/json, so we can get all defaults aggregated making it easier to run tests against them with different scenarios.)
from handlebars-helpers.
@jonschlinkert No worries Jon. Really appreciate how responsive you guys are with addressing these issues. I did try install highlight.js as a top-level dependency and requiring it in the Gruntfile. It did not have any affect unfortunately. Very strange.
from handlebars-helpers.
@jonschlinkert and @doowb. Just wanted to confirm that I have tested the latest v0.4.4 of Assemble with my test project mentioned above and configuring markdown options appears to be working correcly now. I am able to successfully change the langPrefix and the code blocks are being compiled properly.
Thanks!
from handlebars-helpers.
awesome, sorry this took so long for us to fix.
from handlebars-helpers.
Related Issues (20)
- Comparation(#compare var1 "==" var2) with two variables doesn't work HOT 1
- Upgrade for new versions of the related plugins HOT 1
- does not export a 'register' function, cannot import HOT 1
- Create SECURITY.md
- Not splitting string by line breaks '\n' HOT 1
- todo: merge updates from https://github.com/Budibase/handlebars-helpers HOT 3
- Markdown Helper is broken...
- Vulnerability found (due to highlight.js) HOT 3
- isLast in nested forEach
- Titleize handlebar doesn't titleize input string correctly.
- Request: encode to hex HOT 1
- If loading all helpers the String helper reverse overrides the Array helper reverse. HOT 2
- An examples of working out averages on columns
- Handle empty fields
- String helper `split` doesn't split by empty string.
- This package does not install
- Fumanchu - A supported Handlebar + Handlebars-Helpers together! HOT 4
- query online
- Dead? Process to transfer ownership?
- Dependency "ent" uses deprecated Node punycode module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars-helpers.