diff --git a/src/components/code-snippet/__tests__/__snapshots__/code-snippet.test.js.snap b/src/components/code-snippet/__tests__/__snapshots__/code-snippet.test.js.snap index f58fcca7d..3f628a620 100644 --- a/src/components/code-snippet/__tests__/__snapshots__/code-snippet.test.js.snap +++ b/src/components/code-snippet/__tests__/__snapshots__/code-snippet.test.js.snap @@ -92,7 +92,7 @@ See the example: https://docs.mapbox.com//site" gurd murn!\\",\\"description\\":\\"cool code by mapbox\\\\n\\\\nSee the example: [https://docs.mapbox.com//site](https://docs.mapbox.com//site)\\",\\"tags\\":[\\"mapbox\\",\\"maps\\"],\\"css\\":\\"h1 {color: red}\\",\\"js\\":\\"console.log('hurn')\\",\\"css_external\\":\\"\\",\\"js_external\\":\\"\\"}" + value="{\\"title\\":\\"My Code\\",\\"html\\":\\"

gurd murn!

\\",\\"html_pre_processor\\":\\"none\\",\\"description\\":\\"cool code by mapbox\\\\n\\\\nSee the example: [https://docs.mapbox.com//site](https://docs.mapbox.com//site)\\",\\"tags\\":[\\"mapbox\\",\\"maps\\"],\\"css\\":\\"h1 {color: red}\\",\\"css_pre_processor\\":\\"none\\",\\"js\\":\\"console.log('hurn')\\",\\"js_pre_processor\\":\\"none\\",\\"css_external\\":\\"\\",\\"js_external\\":\\"\\"}" /> \\\\n\\\\n\\\\n\\",\\"description\\":\\"Initialize a map in an HTML element with Mapbox GL JS.\\\\n\\\\nSee the example: [https://docs.mapbox.com//mapbox-gl-js/example/simple-map/](https://docs.mapbox.com//mapbox-gl-js/example/simple-map/)\\",\\"tags\\":[\\"mapbox\\",\\"maps\\"],\\"css\\":\\"\\\\n body { margin: 0; padding: 0; }\\\\n #map { position: absolute; top: 0; bottom: 0; width: 100%; };\\\\n\\",\\"js\\":\\"\\\\nmapboxgl.accessToken = '';\\\\nvar map = new mapboxgl.Map({\\\\n container: 'map', // container id\\\\n style: 'mapbox://styles/mapbox/streets-v11', // stylesheet location\\\\n center: [-74.50, 40], // starting position [lng, lat]\\\\n zoom: 9 // starting zoom\\\\n});\\\\n\\",\\"css_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css\\",\\"js_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js\\"}" + value="{\\"title\\":\\"Display a map\\",\\"html\\":\\"\\\\n
\\\\n\\\\n\\\\n\\",\\"html_pre_processor\\":\\"none\\",\\"description\\":\\"Initialize a map in an HTML element with Mapbox GL JS.\\\\n\\\\nSee the example: [https://docs.mapbox.com//mapbox-gl-js/example/simple-map/](https://docs.mapbox.com//mapbox-gl-js/example/simple-map/)\\",\\"tags\\":[\\"mapbox\\",\\"maps\\"],\\"css\\":\\"\\\\n body { margin: 0; padding: 0; }\\\\n #map { position: absolute; top: 0; bottom: 0; width: 100%; };\\\\n\\",\\"css_pre_processor\\":\\"none\\",\\"js\\":\\"\\\\nmapboxgl.accessToken = '';\\\\nvar map = new mapboxgl.Map({\\\\n container: 'map', // container id\\\\n style: 'mapbox://styles/mapbox/streets-v11', // stylesheet location\\\\n center: [-74.50, 40], // starting position [lng, lat]\\\\n zoom: 9 // starting zoom\\\\n});\\\\n\\",\\"js_pre_processor\\":\\"none\\",\\"css_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css\\",\\"js_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js\\"}" /> \\",\\"description\\":\\"Initialize a map in an HTML element with Mapbox GL JS.\\\\n\\\\nSee the example: [https://docs.mapbox.com//mapbox-gl-js/example/simple-map/](https://docs.mapbox.com//mapbox-gl-js/example/simple-map/)\\",\\"tags\\":[\\"mapbox\\",\\"maps\\"],\\"css\\":\\"body { margin: 0; padding: 0; }\\\\n #map { position: absolute; top: 0; bottom: 0; width: 100%; };\\",\\"js\\":\\"var map = new mapboxgl.Map({\\\\n container: 'map', // container id\\\\n style: 'mapbox://styles/mapbox/streets-v11', // stylesheet location\\\\n center: [-74.50, 40], // starting position [lng, lat]\\\\n zoom: 9 // starting zoom\\\\n});\\",\\"css_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css\\",\\"js_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js\\",\\"head\\":\\"\\"}" + value="{\\"title\\":\\"Display a map\\",\\"html\\":\\"

hello world!

\\",\\"html_pre_processor\\":\\"none\\",\\"description\\":\\"Initialize a map in an HTML element with Mapbox GL JS.\\\\n\\\\nSee the example: [https://docs.mapbox.com//mapbox-gl-js/example/simple-map/](https://docs.mapbox.com//mapbox-gl-js/example/simple-map/)\\",\\"tags\\":[\\"mapbox\\",\\"maps\\"],\\"css\\":\\"body { margin: 0; padding: 0; background: yellow; }\\\\n #map { position: absolute; top: 0; bottom: 0; width: 100%; };\\",\\"css_pre_processor\\":\\"none\\",\\"js\\":\\"var map = new mapboxgl.Map({\\\\n container: 'map', // container id\\\\n style: 'mapbox://styles/mapbox/streets-v11', // stylesheet location\\\\n center: [-74.50, 40], // starting position [lng, lat]\\\\n zoom: 9 // starting zoom\\\\n});\\",\\"js_pre_processor\\":\\"none\\",\\"css_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.css\\",\\"js_external\\":\\"https://api.tiles.mapbox.com/mapbox-gl-js/v1.5.0/mapbox-gl.js\\",\\"head\\":\\"\\"}" /> ", + html: "

hello world!

", css: - 'body { margin: 0; padding: 0; }\n #map { position: absolute; top: 0; bottom: 0; width: 100%; };', + 'body { margin: 0; padding: 0; background: yellow; }\n #map { position: absolute; top: 0; bottom: 0; width: 100%; };', frontMatter: { description: 'Initialize a map in an HTML element with Mapbox GL JS.', pathname: '/mapbox-gl-js/example/simple-map/', @@ -29,7 +29,7 @@ testCases.basic = { }; const code = helpers.extractor( - "\n\n\n\nDisplay a map\n\n\n\n\n\n\n
\n\n\n\n" + "\n\n\n\nDisplay a map\n\n\n\n\n\n\n

Hello world!

\n\n\n\n" ); testCases.basicWithHelpers = { diff --git a/src/components/edit/edit.js b/src/components/edit/edit.js index ab0ca22c1..8ddd293f5 100644 --- a/src/components/edit/edit.js +++ b/src/components/edit/edit.js @@ -87,10 +87,13 @@ export default class Edit extends React.Component { value={JSON.stringify({ title: projectMeta.title, html: html, + html_pre_processor: 'none', description: projectMeta.description, tags: projectMeta.tags, css: css, + css_pre_processor: 'none', js: js, + js_pre_processor: 'none', css_external: resources && resources.css ? resources.css.join(';') : '', js_external: